Bug 103765 - run-perf-tests --profile should use iprofiler instead of instruments on Mac
Summary: run-perf-tests --profile should use iprofiler instead of instruments on Mac
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Seidel (no email)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-30 12:56 PST by Eric Seidel (no email)
Modified: 2012-12-02 12:51 PST (History)
8 users (show)

See Also:


Attachments
Patch (3.65 KB, patch)
2012-11-30 13:00 PST, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Made IProfiler.profile_after_exit wait for iprofiler to complete before continuing (4.26 KB, patch)
2012-11-30 13:23 PST, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Patch for landing (4.27 KB, patch)
2012-11-30 14:05 PST, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Fix test-webkitpy (1.89 KB, patch)
2012-12-02 12:23 PST, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Patch for landing (1.89 KB, patch)
2012-12-02 12:26 PST, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2012-11-30 12:56:08 PST
run-perf-tests --profile should use iprofile instead of instruments on Mac
Comment 1 Eric Seidel (no email) 2012-11-30 13:00:10 PST
Created attachment 177015 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-11-30 13:03:10 PST
CCing folks who likely have opinions about Mac profiling tools.

I will caution all that --profile is rather new and not the perfect experience on Mac.  "iprofiler" runs asynchronously from the tests, does its own printing to stderr, and doesn't provide us a way to dump any sort of perf summary from the commandline.  These combine to make it slightly at-odds with the --profile design (which was originally written for linux-command-line-profilers).

In any case, I think --profile will grow to be more useful, and with some help will work cleaner on Mac than it does.
Comment 3 Eric Seidel (no email) 2012-11-30 13:03:53 PST
Forgot to CC folks who have reviewed past --profile patches, sorry.
Comment 4 Eric Seidel (no email) 2012-11-30 13:04:55 PST
One final note:

As I alluded to in the ChangeLog, this is not a strict improvement from /usr/bin/instruments, but I figure that since /usr/bin/instruments seems "deprecated" it's best to move to the newer tool and iterate from there.
Comment 5 Eric Seidel (no email) 2012-11-30 13:23:49 PST
Created attachment 177018 [details]
Made IProfiler.profile_after_exit wait for iprofiler to complete before continuing
Comment 6 Ryosuke Niwa 2012-11-30 13:33:05 PST
Comment on attachment 177018 [details]
Made IProfiler.profile_after_exit wait for iprofiler to complete before continuing

rs=me.
Comment 7 Adam Barth 2012-11-30 13:55:26 PST
Comment on attachment 177018 [details]
Made IProfiler.profile_after_exit wait for iprofiler to complete before continuing

View in context: https://bugs.webkit.org/attachment.cgi?id=177018&action=review

> Tools/Scripts/webkitpy/common/system/profiler.py:101
> +        # FIXME: Consider capturing instead of letting instruments spam to stderr directly.
> +        self._profiler_process = self._host.executive.popen(cmd)

I guess I can try it, but what does it spam to stderr?  Capturing the output and post-processing it like we do for pprof sounds like it might be a good next step.
Comment 8 Eric Seidel (no email) 2012-11-30 14:01:17 PST
Comment on attachment 177018 [details]
Made IProfiler.profile_after_exit wait for iprofiler to complete before continuing

View in context: https://bugs.webkit.org/attachment.cgi?id=177018&action=review

>> Tools/Scripts/webkitpy/common/system/profiler.py:101
>> +        self._profiler_process = self._host.executive.popen(cmd)
> 
> I guess I can try it, but what does it spam to stderr?  Capturing the output and post-processing it like we do for pprof sounds like it might be a good next step.

iprofiler: Profiling process 7271 (DumpRenderTree) for 10 seconds
iprofiler: Profiling completed...
iprofiler: Session saved at /Users/eseidel/Projects/WebKit/WebKitBuild/Release/layout-test-results//Users/eseidel/Projects/WebKit/WebKitBuild/Release/layout-test-results/test.dtps

The output is really nice. :)  But since we don't control it is makes some things more complicated (like changing the name of the to-save-test-file-after Profiler initialization -- which I want to do so I can save these files at test/file/path.trace instead of just test.trace).

One complexity in trying to capture the output is that iprofiler will prompt the user for their password if necessary.  We'd have to make sure to route input to the iprofiler process as well.
Comment 9 Eric Seidel (no email) 2012-11-30 14:02:35 PST
Comment on attachment 177018 [details]
Made IProfiler.profile_after_exit wait for iprofiler to complete before continuing

I now realize I think its splitting out the profile in the wrong place.  Will upload a fix.
Comment 10 Eric Seidel (no email) 2012-11-30 14:05:13 PST
Created attachment 177022 [details]
Patch for landing
Comment 11 Eric Seidel (no email) 2012-11-30 14:05:48 PST
Yup.  Missed a fs.basename() call.  Fixed.
Comment 12 WebKit Review Bot 2012-12-02 03:01:05 PST
Comment on attachment 177022 [details]
Patch for landing

Clearing flags on attachment: 177022

Committed r136327: <http://trac.webkit.org/changeset/136327>
Comment 13 WebKit Review Bot 2012-12-02 03:01:10 PST
All reviewed patches have been landed.  Closing bug.
Comment 14 Glenn Adams 2012-12-02 11:35:56 PST
revision http://trac.webkit.org/changeset/136327 broke test-webkitpy (on mac-mountainlion):

sn-ga-02:webkitsvn glenn$ Tools/Scripts/test-webkitpy
Suppressing most webkitpy logging while running unit tests.
Skipping tests in the following modules or packages because they are really, really, slow:
    webkitpy.common.checkout.scm.scm_unittest
    (https://bugs.webkit.org/show_bug.cgi?id=31818; use --all to include)

Checking imports ...Failed to import webkitpy.common.system.profiler_unittest:
  Traceback (most recent call last):
    File "/Users/glenn/work/webkitsvn/Tools/Scripts/webkitpy/test/main.py", line 176, in _check_imports
      __import__(name)
    File "/Users/glenn/work/webkitsvn/Tools/Scripts/webkitpy/common/system/profiler_unittest.py", line 33, in <module>
      from .profiler import ProfilerFactory, Instruments, GooglePProf
  ImportError: cannot import name Instruments
Comment 15 Eric Seidel (no email) 2012-12-02 12:19:54 PST
Sorry.  Easy fix.  Will fix shortly.
Comment 16 Eric Seidel (no email) 2012-12-02 12:23:50 PST
Reopening to attach new patch.
Comment 17 Eric Seidel (no email) 2012-12-02 12:23:52 PST
Created attachment 177144 [details]
Fix test-webkitpy
Comment 18 Eric Seidel (no email) 2012-12-02 12:24:26 PST
Comment on attachment 177144 [details]
Fix test-webkitpy

Sorry.  the Commit-queue doesn't run test-webkitpy at the moment.  I think Dirk said he's working on fixing that.
Comment 19 WebKit Review Bot 2012-12-02 12:25:50 PST
Comment on attachment 177144 [details]
Fix test-webkitpy

Rejecting attachment 177144 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

/mnt/git/webkit-commit-queue/Tools/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/15120063
Comment 20 Eric Seidel (no email) 2012-12-02 12:26:25 PST
Created attachment 177146 [details]
Patch for landing
Comment 21 Adam Barth 2012-12-02 12:26:44 PST
Comment on attachment 177144 [details]
Fix test-webkitpy

View in context: https://bugs.webkit.org/attachment.cgi?id=177144&action=review

> Tools/ChangeLog:6
> +        Unreviwed.  Updating the unittests after my previous change.

Unreviwed -> Unreviewed.
Comment 22 WebKit Review Bot 2012-12-02 12:49:02 PST
Comment on attachment 177146 [details]
Patch for landing

Clearing flags on attachment: 177146

Committed r136351: <http://trac.webkit.org/changeset/136351>
Comment 23 WebKit Review Bot 2012-12-02 12:49:06 PST
All reviewed patches have been landed.  Closing bug.
Comment 24 Glenn Adams 2012-12-02 12:51:40 PST
thanks, that fixed it (comment #14)