Note: This page is not for general xperf use. It is specific to the ETW integrated into SpiderMonkey, and is currently a disorganized collection of notes while I figure out what all this crazy stuff is.
Oh, and it turns out there is already an xperf usage page on MDC: https://developer.mozilla.org/En/Profiling_with_Xperf
- To use custom events like the MozillaSpiderMonkey provider ones, you will start a session using that provider, and then probably start an additional concurrent session for the kernel events of interest. You will merge the event logs together at the end before analyzing them.
- xperf start command syntax: starts multiple sessions at once (but maybe at most one kernel?)
xperf -on latency -start sess1 -on MozillaSpiderMonkey
will start a kernel session with the 'latency' group of events, and a user session 'sess1' with the MozillaSpiderMonkey provider's events.
xperf -stop sess1 -stop
will stop both the kernel session and the user session 'sess1'.
- Seeing what sessions are logging (?):
xperf -Loggers | grep Name
will dump out all active loggers. There will be several that you didn't start.
Or, the nice way: run perfmon. Go to "Data Collector Sets"/"Event Trace Sessions". The names here even make sense!
- when xperf stops a trace, it injects some custom information (string event names?) into the trace to allow cross-machine decoding (so a manifest is not needed), but only xperf knows how to read that data.
- the resource file is only needed for decoding and has no effect on the actual trace collection: http://www.osronline.com/showthread.cfm?link=161391
logman, tracerpt, wevtutil, and mofcomp are all installed by default on Windows. (wevtutil only exists for Vista+.)
xperf and xperfview come with the SDK. You can also get a standalone installation from http://www.microsoft.com/whdc/system/sysperf/perftools.mspx
On a 64-bit system, to allow stack traces:
REG ADD "HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management" -v DisablePagingExecutive -d 0x1 -t REG_DWORD -f
wevtutil im path/to/manifest.man -rf:c:/windows/path/to/firefox.exe
or perhaps path to ETWProvider.res. (asuth says: I think for the "rf" setting you want to point at your mozjs.dll (or whatever it has been lumped into) since that's what the manifest defines as the resourceFileName. At least, when I did this, it no longer gave an error message about resources not being accessible.)
xperf -start test1 -on MozillaSpiderMonkey dist/bin/firefox.exe -no-remote -P Blank ... xperf -stop test1
xperf -on PROC_THREAD+LOADER+DISK_IO+HARD_FAULTS+INTERRUPT+DPC+CSWITCH -maxbuffers 1024 (do stuff) xperf -d foo.etl xperfview foo.etl
xperf -on Latency -stackwalk profile -start browse -on MozillaSpiderMonkey:::'stack' rem Your scenario goes here... xperf -stop browse -stop -d mytrace.etl
logman start mysession -p MozillaSpiderMonkey -o test1.etl -ets (dostuff) logman stop mysession -ets
tracerpt events.etl -import path/to/manifest.man
You can't do much with custom events in the current xperfview: http://social.msdn.microsoft.com/Forums/en-US/wptk_v4/thread/2655db5f-6d9f-42db-898a-60c05feffc6b
This page covers XP and Windows 7 registration, and talks about logman and tracerpt, which are both nice and simple and just about all I can understand right now.
Description of profiling IE, including some IE ETW providers. (We might want to borrow their event sets...)