Skip to content

Commit

Permalink
Add support for symbolicate profiles. Add profiles to the dashboard j…
Browse files Browse the repository at this point in the history
…son file.
  • Loading branch information
Benoit Girard committed Aug 29, 2012
1 parent 502a200 commit e2e0d75
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
16 changes: 12 additions & 4 deletions bin/get-metric-for-build.py
Expand Up @@ -57,7 +57,7 @@ def get_build_for_date(date):

def run_test(device, outputdir, outputfile, test, url_params, num_runs,
startup_test, no_capture, get_internal_checkerboard_stats, apk=None,
appname = None, appdate = None):
appname = None, appdate = None, profile_file=None):
if apk:
appinfo = eideticker.get_fennec_appinfo(apk)
appname = appinfo['appname']
Expand Down Expand Up @@ -88,6 +88,8 @@ def run_test(device, outputdir, outputfile, test, url_params, num_runs,
args.extend(["--no-capture"])
else:
args.extend(["--capture-file", capture_file])
if profile_file:
args.extend(["--profile-file", profile_file])
print args
retval = subprocess.call(args)
if retval != 0:
Expand Down Expand Up @@ -183,6 +185,9 @@ def main(args=sys.argv[1:]):
dest = "no_capture",
help = "run through the test, but don't actually "
"capture anything")
parser.add_option("--profile-file", action="store",
type="string", dest = "profile_file",
help="Collect a performance profile using the built in profiler.")
parser.add_option("--get-internal-checkerboard-stats",
action="store_true",
dest="get_internal_checkerboard_stats",
Expand Down Expand Up @@ -247,7 +252,8 @@ def main(args=sys.argv[1:]):
options.num_runs,
options.startup_test,
options.no_capture,
options.get_internal_checkerboard_stats, appname=appname)
options.get_internal_checkerboard_stats, appname=appname,
profile_file=options.profile_file)
elif apks:
for apk in apks:
run_test(device, options.outputdir,
Expand All @@ -256,7 +262,8 @@ def main(args=sys.argv[1:]):
options.num_runs,
options.startup_test,
options.no_capture,
options.get_internal_checkerboard_stats, apk=apk)
options.get_internal_checkerboard_stats, apk=apk,
profile_file=options.profile_file)
else:
for date in dates:
apk = get_build_for_date(date)
Expand All @@ -267,7 +274,8 @@ def main(args=sys.argv[1:]):
options.startup_test,
options.no_capture,
options.get_internal_checkerboard_stats, apk=apk,
appdate=date)
appdate=date,
profile_file=options.profile_file)


main()
6 changes: 3 additions & 3 deletions bin/runtest.py
Expand Up @@ -126,8 +126,8 @@ def main(args=sys.argv[1:]):
parser.add_option("--b2g", action="store_true",
dest="b2g", default=False,
help="Run in B2G environment. You do not need to pass an appname")
parser.add_option("--profile-perf", action="store_true",
dest="profile_perf", default=True,
parser.add_option("--profile-file", action="store",
type="string", dest = "profile_file",
help="Collect a performance profile using the built in profiler.")

options, args = parser.parse_args()
Expand Down Expand Up @@ -262,7 +262,7 @@ def main(args=sys.argv[1:]):
if options.startup_test and not options.no_capture:
capture_controller.start_capture(capture_file, device.hdmiResolution,
capture_metadata)
runner.start(isProfiling=options.profile_perf)
runner.start(profileFile=options.profile_file)

# Keep on capturing until we timeout
if capture_timeout:
Expand Down
23 changes: 23 additions & 0 deletions bin/update-dashboard.py
Expand Up @@ -69,13 +69,27 @@ def kill_app(dm, appname):
if name == appname:
dm.runCmd(["shell", "echo kill %s | su" % pid])

def symbolicateProfilePackage(profile_package, profile_path, profile_file)
retval = subprocess.call(["./symbolicate.sh",
os.path.abspath(profile_package), os.path.abspath(profile_file)],
cwd="../src/GeckoProfilerAddon")
if retval == 0:
return profile_path
else:
return None

def runtest(dm, product, current_date, appname, appinfo, test, capture_name,
outputdir, datafile, data):
capture_file = os.path.join(CAPTURE_DIR,
"%s-%s-%s-%s.zip" % (test['name'],
appname,
appinfo.get('date'),
int(time.time())))
profile_package = os.path.join(CAPTURE_DIR,
"profile-package-%s-%s-%s-%s.zip" % (test['name'],
appname,
appinfo.get('date'),
int(time.time())))
urlparams = test.get('urlparams', '')

test_completed = False
Expand All @@ -85,6 +99,7 @@ def runtest(dm, product, current_date, appname, appinfo, test, capture_name,
retval = subprocess.call(["runtest.py", "--url-params", urlparams,
"--name", capture_name,
"--capture-file", capture_file,
"--profile-file", profile_package,
appname, test['path']])
if retval == 0:
test_completed = True
Expand All @@ -104,6 +119,13 @@ def runtest(dm, product, current_date, appname, appinfo, test, capture_name,
video_file = os.path.join(outputdir, video_path)
open(video_file, 'w').write(capture.get_video().read())

# profile file
if profile_package != None:
profile_path = os.path.join('profiles', 'sps-profile-%s.zip' % time.time())
profile_file = os.path.join(outputdir, profile_path)
profile_path = symbolicateProfilePackage(profile_package, profile_path, profile_file)
os.remove(profile_package)

# frames-per-second / num unique frames
num_unique_frames = videocapture.get_num_unique_frames(capture)
fps = videocapture.get_fps(capture)
Expand All @@ -122,6 +144,7 @@ def runtest(dm, product, current_date, appname, appinfo, test, capture_name,
'checkerboard': checkerboard,
'uniqueframes': num_unique_frames,
'video': video_path,
'profile': profile_path,
'appdate': appinfo.get('date'),
'buildid': appinfo.get('buildid'),
'revision': appinfo.get('revision') }
Expand Down
Empty file.
10 changes: 8 additions & 2 deletions src/eideticker/eideticker/runner.py
Expand Up @@ -206,7 +206,7 @@ def get_profile_and_symbols(self, targetZip):

os.system("ls " + tmpDir);

def start(self, isProfiling=False):
def start(self, profileFile=None):
print "Starting %s... " % self.appname

# for fennec only, we create and use a profile
Expand All @@ -221,8 +221,9 @@ def start(self, isProfiling=False):
if not self.dm.pushDir(profile.profile, self.remote_profile_dir):
raise Exception("Failed to copy profile to device")

self.isProfiling = isProfiling
self.isProfiling = profileFile != None
if self.isProfiling == True:
self.profileFile = profileFile
mozEnv = { "MOZ_PROFILER_STARTUP": "true" }
else:
mozEnv = None
Expand All @@ -249,5 +250,10 @@ def stop(self):
time.sleep(10)

self.dm.killProcess(self.appname)

# Process the profile
if self.isProfiling == True:
self.get_profile_and_symbols(self.profileFile)

if not self.dm.removeDir(self.remote_profile_dir):
print "WARNING: Failed to remove profile (%s) from device" % self.remote_profile_dir

0 comments on commit e2e0d75

Please sign in to comment.