Make split-profile run jprof in the directory with the jprof-log. No bug.
authorL. David Baron <dbaron@dbaron.org>
Mon, 20 Apr 2015 23:10:40 -0700
changeset 258397 760d5062419a4974c25f9e13fabf410791843085
parent 258396 7e2bf34ef49d70c69b5086ed5d34a84174f15eaa
child 258398 da024a455adc28aa40f6b05eef46dca7b2e45ebf
push id1636
push userahalberstadt@mozilla.com
push dateTue, 21 Apr 2015 14:13:18 +0000
milestone40.0a1
Make split-profile run jprof in the directory with the jprof-log. No bug.
tools/jprof/split-profile.py
--- a/tools/jprof/split-profile.py
+++ b/tools/jprof/split-profile.py
@@ -88,17 +88,24 @@ splits = read_splits(splitfile)
 
 def generate_profile(options, destfile):
     """
     Run jprof to generate one split of the profile.
     """
     args = [jprof] + options + passthrough
     print "Generating {0}".format(destfile)
     destio = open(destfile, "w")
-    process = subprocess.Popen(args, stdout=destio)
+    # jprof expects the "jprof-map" file to be in its current working directory
+    cwd = None
+    for option in passthrough:
+        if option.find("jprof-log"):
+            cwd = os.path.dirname(option)
+    if cwd is None:
+        raise StandardError("no jprof-log option given")
+    process = subprocess.Popen(args, stdout=destio, cwd=cwd)
     process.wait()
     destio.close()
     if process.returncode != 0:
         os.remove(destfile)
         sys.stderr.write("Error {0} from command:\n  {1}\n".format(process.returncode, " ".join(args)))
         sys.exit(process.returncode)
 
 def output_filename(number, splitname):