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.
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.
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.
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.
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.
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.