diff options
author | Ico Doornekamp <ico@pruts.nl> | 2020-07-09 19:18:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 19:18:35 +0200 |
commit | d7ccd82eacd7a03c7cf31ea56315c3a35218e122 (patch) | |
tree | 972de247bb66194bab8c5c1c27d205a4adfceb8b /compiler/vmdef.nim | |
parent | c38a459582fb4744ce4abcba2d278b48857c0a31 (diff) | |
download | Nim-d7ccd82eacd7a03c7cf31ea56315c3a35218e122.tar.gz |
VM profiler (#14833)
* Crude VM profiler * Added --profileVM flag, refactoring * fixed FileLine hash * Use TLineInfo instead of own FileLine, updated formatting * Refactoring, moved PStackFrame to vmdefs for cleaner data structure * Moved vmprofiler to separate file * Simplified TLineInfo hash, use toFileLineCol for output * Hash * Moved profile data into Config, dump only once at end of run * Changed profile output header to show '#instr' instead of 'count' * Do not accumulate instrcount for non-top frames Co-authored-by: Ico Doornekamp <git@zevv.nl>
Diffstat (limited to 'compiler/vmdef.nim')
-rw-r--r-- | compiler/vmdef.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index 7b51c626d..9228ce5eb 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -261,6 +261,21 @@ type config*: ConfigRef graph*: ModuleGraph oldErrorCount*: int + profiler*: Profiler + + PStackFrame* = ref TStackFrame + TStackFrame* = object + prc*: PSym # current prc; proc that is evaluated + slots*: seq[TFullReg] # parameters passed to the proc + locals; + # parameters come first + next*: PStackFrame # for stacking + comesFrom*: int + safePoints*: seq[int] # used for exception handling + # XXX 'break' should perform cleanup actions + # What does the C backend do for it? + Profiler* = object + tEnter*: float + tos*: PStackFrame TPosition* = distinct int |