Bug 24253 - Add functions to ChromiumBridge for profiler API control
Summary: Add functions to ChromiumBridge for profiler API control
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Antony Sargent
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-27 15:58 PST by Antony Sargent
Modified: 2009-03-23 11:37 PDT (History)
0 users

See Also:


Attachments
Patch (1.23 KB, patch)
2009-02-27 16:03 PST, Antony Sargent
fishd: review-
Details | Formatted Diff | Diff
Patch v2 (1.31 KB, patch)
2009-02-27 17:52 PST, Antony Sargent
fishd: review-
Details | Formatted Diff | Diff
Patch v3 (1.31 KB, patch)
2009-03-02 09:24 PST, Antony Sargent
fishd: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antony Sargent 2009-02-27 15:58:35 PST
patch forthcoming
Comment 1 Antony Sargent 2009-02-27 16:03:26 PST
Created attachment 28105 [details]
Patch
Comment 2 Darin Fisher (:fishd, Google) 2009-02-27 16:08:28 PST
Comment on attachment 28105 [details]
Patch

>Index: ChangeLog

>+2009-02-27  Antony Sargent  <asargent@chromium.org>
>+
>+        Reviewed by NOBODY (OOPS!).
>+
>+        Add functions to ChromiumBridge for profiler API control (eg Quantify) 
>+
>+        * platform/chromium/ChromiumBridge.h:

nit: please include a bug link in the ChangeLog.


>Index: platform/chromium/ChromiumBridge.h

>+        // PerformanceProfiler ------------------------------------------------
>+        static void performanceProfilerStart();

nit: wouldn't it be sufficient to just use the prefix "profiler"?  usually a
profiler has to do with performance.


>+        static void performanceProfilerSetThreadName(char *name);

nit: that should be (const char* name)
Comment 3 Sam Weinig 2009-02-27 16:19:09 PST
What kind of profiler is this being used for?  Where will this be called in WebCore?
Comment 4 Antony Sargent 2009-02-27 17:46:57 PST
(In reply to comment #3)
> What kind of profiler is this being used for?  Where will this be called in
> WebCore?
> 

It's to expose control of Quantify (a companion tool to Purify, if you aren't familiar with it) to javascript functions in developer builds. For instance, imagine you have a layout test and want to profile some pieces of running javascript but ignore others; you can then write something like:

var profiler = new window.chromium.Profiler();
profiler.stop();
profiler.clear();
profiler.setThreadName("my test thread");
doSetupThatShouldntBeProfiled(); 
profiler.start();
doTest();
profiler.stop();

This is something that would only be exposed in developer builds compiled with Purify; not in regular builds. It's going in the Chromium bridge so that our javascript extension code can call through to the chrome code that links against the purify API. See these files for our abstraction of the Purify memory debugging API:

http://src.chromium.org/viewvc/chrome/trunk/src/base/memory_debug.h
http://src.chromium.org/viewvc/chrome/trunk/src/base/memory_debug.cc

(I'll be adding a similar class for the quantify performance profiler.) 

Comment 5 Antony Sargent 2009-02-27 17:52:37 PST
Created attachment 28110 [details]
Patch v2
Comment 6 Darin Fisher (:fishd, Google) 2009-02-28 10:55:34 PST
Comment on attachment 28110 [details]
Patch v2

>Index: platform/chromium/ChromiumBridge.h
...
>         // Widget -------------------------------------------------------------
>         static void widgetSetCursor(Widget*, const Cursor&);
>         static void widgetSetFocus(Widget*);
>+
>+        // Profiler -----------------------------------------------------------
>+        static void profilerStart();
>+        static void profilerStop();
>+        static void profilerClearData();
>+        static void profilerSetThreadName(const char *name);

one more stylistic problem that i forgot to mention... the groups in
ChromiumBridge are intentionally alphabetized, but this breaks that.
please sort them :)

also, please note that webkit style says to write |const char* name|
instead of |const char *name|.  sorry for not making that more clear
in my previous review.

otherwise, this change LG.  but please upload a clean patch.  thanks!
Comment 7 Antony Sargent 2009-03-02 09:24:28 PST
Created attachment 28179 [details]
Patch v3
Comment 8 Darin Fisher (:fishd, Google) 2009-03-05 21:23:23 PST
Antony, this bug can be closed now given your recent Chromium work, right?
Comment 9 Antony Sargent 2009-03-05 22:22:20 PST
Yes. 

(For the record and/or in case anyone else is interested, we found a better way to expose JS extensions in Chromium code that won't involve having to go through the ChromiumBridge. Those changes are at http://codereview.chromium.org/40132 )