How to Run Talos in Profiling Mode
When profiling is enabled, we use the Gecko Profiler to capture profiles during each Talos run that can then be displayed by perf.html. The captured profiles are grouped into zip files, one per Talos test, which are placed into the upload directory.
1. When you push to try, add "mozharness: --geckoProfile" after "try: ..." to your commit message. Example:
try: -b o -p macosx64,win32,win64 -u none -t all[10.6,10.8,Windows XP,Windows 7,Windows 8] mozharness: --geckoProfile
2. When the tests finishes and you select the run in treeherder, you should see links to open the collected profiles in perf.html. [This is currently broken. I think you'll need to download the profile zip artifacts manually, extract them, and load individual profile files into perf.html by dragging them into perf-html.io.]
When running Talos locally
If you're running Talos using
mach talos-test, you only need to append
--geckoProfile to the command and the rest should happen automatically.
After the Talos run is done, you will have a zip file with multiple profiles in your Talos "upload dir", which is, by default, at
testing/mozharness/build/blobber_upload_dir. Unzip that file, and then go to perf.html and pick one of the extracted JSON files in order to display it.
If you're on Windows and want to profile a Firefox build that you compiled yourself, make sure it contains profiling information and you have a symbols zip for it, by following the directions on MDN.
The Talos results with profiling are always higher, so how can I even use this?
Yes, profiling usually has non-trivial overhead. This is why you might want to try one of these approaches:
- Use Talos profiling only when you already know that there is a problem.
- Do a Talos run with profiling on before and after your change and compare those numbers.
- Do a Talos run with profiling off to check if the issue still exists and at the same time do a run with profiling on to get the data from it.
Why are the Windows tests sometimes hanging with profiling on?
There's a known issue with Talos profiling on Windows. See this bug.
I need to download all the profiles! Help!
Try this python script:
import urllib2 import json from pprint import pprint import re from StringIO import StringIO import gzip import os import sys if len(sys.argv) < 2: print "usage:" , sys.argv , "<try revision>" exit(1) builds = json.loads(urllib2.urlopen('https://tbpl.mozilla.org/php/getRevisionBuilds.php?branch=try&rev='+ sys.argv).read()) if len(builds) == 0: print "No bulids found for this revision" exit(1) i = 0 for build in builds: name = build['buildername'] print i, '/', len(builds), name i += 1 name = name.replace(' ', '_') log = gzip.GzipFile(fileobj=StringIO(urllib2.urlopen(build['log']).read())).read() zips = re.findall("TinderboxPrint: Uploaded (profile_[a-zA-Z0-9-_]+\.zip) to ([^\n]+)", log) for zipp in zips: print ' ', zipp try: os.mkdir(name) except OSError: pass with open(os.path.join(name, zipp), 'w') as out: out.write(urllib2.urlopen(zipp).read()) print