GNOME Bugzilla – Bug 572113
add profiler
Last modified: 2009-02-17 14:39:18 UTC
Using sysprof and such in javascript heavy application is next to useless as most of the time spent would be attributed to js_Invoke, or js_CallFunction or similar. Would be more useful to get profiling data attributed to javascript functions.
Created attachment 128892 [details] [review] add profiler Sending signal USR1 writes current profile statistics to file ${GJS_DEBUG_PROFILER_OUTPUT}.${pid}.${counter++} Usage: $ GJS_DEBUG_PROFILER_OUTPUT=/tmp/gjs-profiler gjs-console ... $ kill -USR1 `pidof gjs-console` <do something> $ kill -USR1 `pidof gjs-consle` $ gnumeric /tmp/gjs-profiler.`pidof gjs-console`.1 The log file contains number of calls made to a function, time spent in the function and its descendants. Example output (with common filename prefix removed) : file:line function calls self total modules/jsUnit.js:105 _validateArguments 2 0.01 0.01 testGI.js:1 (unknown) 1 0.00 1.08 modules/jsUnit.js:452 gjstestRun 1 0.01 1.07 (native):0 GIRepositoryNamespace 1 0.00 0.00 modules/jsUnit.js:67 _displayStringForValue 2 0.01 0.01 modules/jsUnit.js:219 setUp 2 0.01 0.01 (native):0 Object 3 0.01 0.01 modules/jsUnit.js:88 argumentsIncludeComments 5 0.01 0.01 modules/jsUnit.js:197 assertRaises 1 0.00 0.18 testGI.js:10 anonymous 1 0.00 0.13 (native):0 (unknown) 2 0.03 0.11 modules/jsUnit.js:222 tearDown 2 0.00 0.00 modules/jsUnit.js:50 jsUnitFixTop 1 0.01 0.01 (native):0 Error 2 0.01 0.01 (native):0 log 2 0.03 0.03 testGI.js:1 testUTF8 1 0.01 0.59 gjs_throw:0 anonymous 2 0.01 0.03 modules/jsUnit.js:111 _assert 2 0.01 0.01 (native):0 GIRepositoryFunction 2 0.01 0.01 modules/jsUnit.js:146 assertEquals 1 0.00 0.11 modules/jsUnit.js:99 nonCommentArg 3 0.02 0.03 modules/jsUnit.js:92 commentArg 2 0.01 0.02 modules/jsUnit.js:1 (unknown) 1 0.01 0.07 (native):0 GIRepository 1 0.00 0.00 testGI.js:7 testThrows 1 0.01 0.20
Looks very nice to me
Committed as 2cf2181ed25133d7376678a97765235d70b870f0