Last Comment Bug 807854 - [meta] Profile JS shell benchmarks with the Gecko profiler.
: [meta] Profile JS shell benchmarks with the Gecko profiler.
Status: NEW
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
: -- normal with 3 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 709381 810062 812063 812946
Blocks: IonSpeed
  Show dependency treegraph
 
Reported: 2012-11-01 17:01 PDT by Nicolas B. Pierron [:nbp]
Modified: 2014-07-24 11:07 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Support text output for d (dynamic) and n (line) entries. (3.19 KB, patch)
2012-11-05 10:13 PST, Nicolas B. Pierron [:nbp]
no flags Details | Diff | Splinter Review
Enable sampling at 100µs. (1.60 KB, patch)
2012-11-19 15:44 PST, Nicolas B. Pierron [:nbp]
no flags Details | Diff | Splinter Review

Description Nicolas B. Pierron [:nbp] 2012-11-01 17:01:10 PDT
Many solution are working on getting profile information, such as oprofile, or instrumented profilers such as VTune and cachegrind (with a patch) for inspecting the JS events at the assembly level.  Callgrind profiles calls locations and show important locations, but it does not annotate the compiled code and makes JS functions difficult to grasp.

Gecko already has an integrated profiler, which is able to identify C++ and JS frames, and help identifying where issues are located with a call stack representation.  The output of the profiler should also be enough to produce a callgrind like output which might be understandable by kcachegrind or other visualizers.
Comment 1 Nicolas B. Pierron [:nbp] 2012-11-05 10:13:53 PST
Created attachment 678373 [details] [diff] [review]
Support text output for d (dynamic) and n (line) entries.

Currently the TableTicker is extremely tied to XPCom, and it does not sounds to be an easy task to share common pieces between the JS engine and the XPCom profiler.

In the mean time, with this patch, we can dump the output as text from the xpcshell with the following command:

xpcshell -e '
  const Ci = Components.interfaces;
  const Cc = Components.classes;
  var profiler = Cc["@mozilla.org/tools/profiler;1"]
    .getService(Ci.nsIProfiler);
  profiler.StartProfiler(100000, 1, ["js","stackwalk"], 1 /* 2 */);' \
  -f ./run.js \
  -e 'var profileStr = profiler.GetProfile();print(profileStr);'

with run.js being the script that you are trying to profile.
Comment 2 Benoit Girard (:BenWa) 2012-11-05 10:28:00 PST
The old format is no longer supported. New features are not supported in this profile and I also want to remove the support from the UI. Right now you can get the profile as a JSObject and should be able to save it as a json string. I've been wanting to add an implemenentation of JSObjectBuilder that doesn't depend on the js engine that can output to a json string directly.
Comment 3 Benoit Girard (:BenWa) 2012-11-07 08:25:45 PST
Comment on attachment 678373 [details] [diff] [review]
Support text output for d (dynamic) and n (line) entries.

Let me know if you need more feedback.
Comment 4 Nicolas B. Pierron [:nbp] 2012-11-14 18:46:09 PST
I renamed the bug to make it a meta Bug since I had to fix multiple issues to fix it locally.  I still have to clean-up patches and find the right bug to attach them to and also create a wiki page for documenting this process.
Comment 5 Nicolas B. Pierron [:nbp] 2012-11-19 15:44:39 PST
Created attachment 683345 [details] [diff] [review]
Enable sampling at 100µs.

This patch is a dirty hack to sample the xpcshell with a period below the milli-second.
Comment 6 Benoit Girard (:BenWa) 2012-11-19 16:38:11 PST
It would be nice to actually land a patch for microsecond profiling. We can use a feature 'microsecond' to indicate that the interval passes is in non default microsecond units and get feature to indicate that it's supported by the platform.

Note You need to log in before you can comment on or make changes to this bug.