Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't profile nim compiler #10106

Closed
timotheecour opened this issue Dec 27, 2018 · 4 comments
Closed

can't profile nim compiler #10106

timotheecour opened this issue Dec 27, 2018 · 4 comments
Assignees

Comments

@timotheecour
Copy link
Member

timotheecour commented Dec 27, 2018

profiling nim compiler is an important thing, so we can find and improve compile time performance bottlenecks, but right now doesn't work:

nim c --profiler:on compiler/nim.nim
compiler/nim c -o:/tmp/z01  compiler/nim.nim # fails with [1]

likewith with -d:nimCallDepthLimit=32767 (using int16.high ; impossilbe to go higher)

Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/.config/nim/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/git_clone/nim/Nim/compiler/nim.cfg' [Conf]
Hint: used config file '/Users/timothee/git_clone/nim/Nim/config/config.nims' [Conf]
Traceback (most recent call last)
/Users/timothee/git_clone/nim/Nim/compiler/nim.nim(109) nim
/Users/timothee/git_clone/nim/Nim/compiler/nim.nim(73) handleCmdLine
/Users/timothee/git_clone/nim/Nim/compiler/cmdlinehelper.nim(92) loadConfigsAndRunMainCommand
/Users/timothee/git_clone/nim/Nim/compiler/main.nim(170) mainCommand
/Users/timothee/git_clone/nim/Nim/compiler/main.nim(78) commandCompileToC
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(134) compileProject
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(79) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(197) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(609) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(572) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(2048) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(915) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2602) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(212) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(182) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(154) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(92) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(79) compileModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(197) processModule
/Users/timothee/git_clone/nim/Nim/compiler/passes.nim(86) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(609) myProcess
/Users/timothee/git_clone/nim/Nim/compiler/sem.nim(572) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim/compiler/semstmts.nim(2048) semStmt
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(915) semExprNoType
/Users/timothee/git_clone/nim/Nim/compiler/semexprs.nim(2602) semExpr
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(212) evalImport
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(182) impMod
/Users/timothee/git_clone/nim/Nim/compiler/importer.nim(154) myImportModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(92) importModule
/Users/timothee/git_clone/nim/Nim/compiler/modules.nim(79) compileModule
(1874 calls omitted) ...
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(44) ==
/Users/timothee/git_clone/nim/Nim/lib/system.nim ==
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(153) hook
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(106) hookAux
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(44) ==
/Users/timothee/git_clone/nim/Nim/lib/system.nim ==
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(153) hook
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(106) hookAux
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(44) ==
/Users/timothee/git_clone/nim/Nim/lib/system.nim ==
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(153) hook
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(106) hookAux
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(44) ==
/Users/timothee/git_clone/nim/Nim/lib/system.nim ==
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(153) hook
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(106) hookAux
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(44) ==
/Users/timothee/git_clone/nim/Nim/lib/system.nim ==
...
/Users/timothee/git_clone/nim/Nim/lib/system.nim ==
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(153) hook
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(106) hookAux
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(44) ==
/Users/timothee/git_clone/nim/Nim/lib/system.nim ==
/Users/timothee/git_clone/nim/Nim/lib/pure/nimprof.nim(143) requestedHook
/Users/timothee/git_clone/nim/Nim/lib/system/timers.nim getTicks
Error: call depth limit reached in a debug build (2000 function calls). You can change it with -d:nimCallDepthLimit=<int> but really try to avoid deep recursions instead.
writing profile_results.txt...

note

EDIT: if I add -d:release, it succeeds, but then the profile_results.txt is useless:

total executions of each stack trace:
Entry: 1/1 Calls: 2436/2436 = 100.00% [sum: 2436; 2436/2436 = 100.00%]
@timotheecour timotheecour changed the title can't profile nim compiler can't profile nim compiler (unless -d:release is passed) Dec 27, 2018
@timotheecour timotheecour changed the title can't profile nim compiler (unless -d:release is passed) can't profile nim compiler Dec 27, 2018
@Araq
Copy link
Member

Araq commented Dec 27, 2018

But proc `==`(a, b: StackTrace): bool is in an .push profiler: off environment why would it call into the profiliing hook. Yet another configuration problem?

timotheecour added a commit to timotheecour/Nim that referenced this issue Dec 28, 2018
@timotheecour
Copy link
Member Author

timotheecour commented Dec 28, 2018

fix: see PR #10119

timotheecour added a commit to timotheecour/Nim that referenced this issue Dec 30, 2018
timotheecour added a commit to timotheecour/Nim that referenced this issue Dec 30, 2018
@timotheecour timotheecour self-assigned this Jan 7, 2019
timotheecour added a commit to timotheecour/Nim that referenced this issue Jan 9, 2019
@stale stale bot added the stale Staled PR/issues; remove the label after fixing them label Aug 4, 2020
@ringabout ringabout removed the stale Staled PR/issues; remove the label after fixing them label Mar 3, 2021
@nim-lang nim-lang deleted a comment from stale bot Oct 8, 2021
@ringabout
Copy link
Member

Use valgrind or vtune to profile instead, both of which work like a charm!

@ringabout
Copy link
Member

image

@ringabout ringabout closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants