Open Bug 807854 Opened 12 years ago Updated 1 year ago

[meta] Profile JS shell benchmarks with the Gecko profiler.

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect

Tracking

()

People

(Reporter: nbp, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: meta)

Attachments

(2 files)

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.
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.
Attachment #678373 - Flags: feedback?(bgirard)
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 on attachment 678373 [details] [diff] [review]
Support text output for d (dynamic) and n (line) entries.

Let me know if you need more feedback.
Attachment #678373 - Flags: feedback?(bgirard)
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.
Blocks: IonSpeed
Depends on: 810062
Summary: Integrate the Sampling profiler in the JS shell. → [meta] Profile JS shell benchmarks with the Gecko profiler.
Depends on: 709381
Depends on: 812063
Depends on: 812946
This patch is a dirty hack to sample the xpcshell with a period below the milli-second.
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.
Assignee: general → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: