This document describes how to run various profiling services in Komodo. There are currently two ways to profile Komodo, each having strenghts and weakness. These are the javascript profiler, and the pyxpcom trace profiler.
Unfortunately no method to profile all of JavaScript and Python together is available, though generally if your profiling JavaScript, you will inadvertingly be profiling all calls that go through XPCOM (though you won't see the underlying Python/C++ functions).
Use the ko/profiler
JS module. Profiles are dumped to your profile folder. To open them use Cleopatra.
To record named profiles you need to set the profilerEnabledName
string pref.
To record unnamed profiles you need to first call require("ko/profiler").enable()
.
Profiling results are saved to the "profiler" folder within your Komodo profile folder.
For one off profiling you can use the following userscripts instead of the above:
Start JavaScript Profiler
require("ko/profiler").enable();
require("ko/profiler").start();
Stop JavaScript Profiler
require("ko/profiler").save();
require("ko/profiler").stop();
You can profile python using cProfile
import cProfile
pr = cProfile.Profile()
pr.enable()
# MY CODE
pr.disable()
pr.dump_stats('/tmp/profiledump')
This userscript will profile the next 10 seconds of execution, then save the result to /tmp/koprofile
import cProfile, signal
pr = cProfile.Profile()
pr.enable()
def whenDone(signum, frame):
pr.disable()
pr.dump_stats('/tmp/koprofile')
signal.signal(signal.SIGALRM, signal.SIG_DFL)
signal.setitimer(signal.ITIMER_REAL, 0)
signal.signal(signal.SIGALRM, whenDone)
signal.setitimer(signal.ITIMER_REAL,10)
sys.path
inside Komodo to find out)import meliae.scanner
meliae.scanner.dump_all_objects("/tmp/memorydump.json")
To turn on the trace profiling, do::
export KO_PYXPCOM_PROFILE=1
This turns on the code profiler in python, and wraps all python xpcom objects in order to profile calls over xpcom. Upon shutting down Komodo, the profiler will print out a summary of the executed Python/XPCOM code.
Documentation Archive (older versions)
© 2017 ActiveState Software Inc. All rights reserved. ActiveState®,
Komodo®, ActivePerl®, ActivePython®, and ActiveTcl® are registered
trademarks of ActiveState.
All other marks are property of their respective owners.