Title: [137952] trunk/Tools
Revision
137952
Author
[email protected]
Date
2012-12-17 15:28:08 -0800 (Mon, 17 Dec 2012)

Log Message

Cleanup --profiler=perf code a little and allow up to 1000 report files (instead of 100)
https://bugs.webkit.org/show_bug.cgi?id=105217

Reviewed by Dirk Pranke.

Previously --profile would fail strangely if find_unused_filename returned None
(which would happen as soon as we had 100 report files).
Now we'll search through 1000 filenames before giving up (and assert if we failed to find one).
I also made some minor cleanups to the output of perf, and tried to make the
commands more self-documenting by using long-names for args.

* Scripts/webkitpy/common/system/profiler.py:
(SingleFileOutputProfiler.__init__):
(Perf.attach_to_pid):
(Perf.profile_after_exit):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (137951 => 137952)


--- trunk/Tools/ChangeLog	2012-12-17 23:10:41 UTC (rev 137951)
+++ trunk/Tools/ChangeLog	2012-12-17 23:28:08 UTC (rev 137952)
@@ -1,3 +1,21 @@
+2012-12-17  Eric Seidel  <[email protected]>
+
+        Cleanup --profiler=perf code a little and allow up to 1000 report files (instead of 100)
+        https://bugs.webkit.org/show_bug.cgi?id=105217
+
+        Reviewed by Dirk Pranke.
+
+        Previously --profile would fail strangely if find_unused_filename returned None
+        (which would happen as soon as we had 100 report files).
+        Now we'll search through 1000 filenames before giving up (and assert if we failed to find one).
+        I also made some minor cleanups to the output of perf, and tried to make the
+        commands more self-documenting by using long-names for args.
+
+        * Scripts/webkitpy/common/system/profiler.py:
+        (SingleFileOutputProfiler.__init__):
+        (Perf.attach_to_pid):
+        (Perf.profile_after_exit):
+
 2012-12-17  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r137198.

Modified: trunk/Tools/Scripts/webkitpy/common/system/profiler.py (137951 => 137952)


--- trunk/Tools/Scripts/webkitpy/common/system/profiler.py	2012-12-17 23:10:41 UTC (rev 137951)
+++ trunk/Tools/Scripts/webkitpy/common/system/profiler.py	2012-12-17 23:28:08 UTC (rev 137952)
@@ -86,7 +86,9 @@
 class SingleFileOutputProfiler(Profiler):
     def __init__(self, host, executable_path, output_dir, output_suffix, identifier=None):
         super(SingleFileOutputProfiler, self).__init__(host, executable_path, output_dir, identifier)
-        self._output_path = self._host.workspace.find_unused_filename(self._output_dir, self._identifier, output_suffix)
+        # FIXME: Currently all reports are kept as test.*, until we fix that, search up to 1000 names before giving up.
+        self._output_path = self._host.workspace.find_unused_filename(self._output_dir, self._identifier, output_suffix, search_limit=1000)
+        assert(self._output_path)
 
 
 class GooglePProf(SingleFileOutputProfiler):
@@ -139,7 +141,7 @@
     def attach_to_pid(self, pid):
         assert(not self._perf_process and not self._pid_being_profiled)
         self._pid_being_profiled = pid
-        cmd = [self._perf_path(), "record", "-g", "-p", pid, "-o", self._output_path]
+        cmd = [self._perf_path(), "record", "--call-graph", "--pid", pid, "--output", self._output_path]
         self._perf_process = self._host.executive.popen(cmd)
 
     def _first_ten_lines_of_profile(self, perf_output):
@@ -159,13 +161,16 @@
             print "'perf record' failed (exit code: %i), can't process results:" % perf_exitcode
             return
 
-        perf_args = [self._perf_path(), 'report', '-g', 'none', '-i', self._output_path]
+        perf_args = [self._perf_path(), 'report', '--call-graph', 'none', '--input', self._output_path]
+        print "First 10 lines of 'perf report --call-graph=none':"
+
         print " ".join(perf_args)
         perf_output = self._host.executive.run_command(perf_args)
         print self._first_ten_lines_of_profile(perf_output)
 
         print "To view the full profile, run:"
         print ' '.join([self._perf_path(), 'report', '-i', self._output_path])
+        print  # An extra line between tests looks nicer.
 
 
 class Sample(SingleFileOutputProfiler):
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to