mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
document ANKI_PROFILE_CODE and add bazel command to run snakeviz
This commit is contained in:
parent
1020381ca3
commit
32b6e8e198
5 changed files with 21 additions and 0 deletions
|
@ -210,6 +210,8 @@ If TRACESQL is set, all sql statements will be printed as they are executed.
|
|||
If LOGTERM is set before starting Anki, warnings and error messages that are normally placed
|
||||
in the collection2.log file will also be printed on stdout.
|
||||
|
||||
If ANKI_PROFILE_CODE is set, Python profiling data will be written on exit.
|
||||
|
||||
## Cleaning
|
||||
|
||||
Unlike the old Make system, a "clean build" should almost never be required
|
||||
|
|
|
@ -17,6 +17,7 @@ pylint
|
|||
pytest
|
||||
requests[socks]
|
||||
send2trash
|
||||
snakeviz
|
||||
stringcase
|
||||
waitress
|
||||
fluent-syntax
|
||||
|
|
|
@ -128,3 +128,12 @@ py_binary(
|
|||
"//qt/aqt:aqt_with_data",
|
||||
],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "profile",
|
||||
srcs = ["tools/profile.py"],
|
||||
tags = ["manual"],
|
||||
deps = [
|
||||
requirement("snakeviz"),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -392,6 +392,7 @@ def write_profile_results():
|
|||
profiler.disable()
|
||||
profiler.dump_stats("anki.prof")
|
||||
print("profile stats written to anki.prof")
|
||||
print("use 'bazel run qt:profile' to explore")
|
||||
|
||||
|
||||
def run():
|
||||
|
|
8
qt/tools/profile.py
Executable file
8
qt/tools/profile.py
Executable file
|
@ -0,0 +1,8 @@
|
|||
import sys, os
|
||||
import snakeviz
|
||||
|
||||
from snakeviz.cli import main
|
||||
|
||||
profile = os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "anki.prof")
|
||||
sys.argv.append(profile)
|
||||
sys.exit(main())
|
Loading…
Reference in a new issue