[chromium] Implement TRACE_EVENT macros for sampling profiling
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2013 01:42:20 +0000 (01:42 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Mar 2013 01:42:20 +0000 (01:42 +0000)
commit24cfa9235e9d0f28f6e14f1600864a03ab00eea8
tree782b56344c450ed2b6fab2c6deda1b4b19892da7
parent07e528fe300e0da6494379fdfb32028cb505db54
[chromium] Implement TRACE_EVENT macros for sampling profiling
https://bugs.webkit.org/show_bug.cgi?id=110932

Reviewed by Adam Barth.

We are implementing TRACE_EVENT macros for sampling profiling.
It works in the following mechanism:

- Chromium defines global state variables for sampling profiling.
(i.e. g_trace_state0, g_trace_state1, g_trace_state2 in trace_event.h)

- WebKit gets the addresses of the global state variables at the
initialization step. (i.e. EventTracer::initialize())

- WebKit updates the global states by using TRACE_EVENT_SAMPLING_STATE()
macros every time WebKit changes its state. (e.g. DOM attribute
getters/setters/methods)

- A sampling thread running in Chrome reads the global states
periodically and visualizes the profiling results into about://tracing.

This patch implements (1) a WebKit API to get the addresses of
the global states and (2) the TRACE_EVENT_SAMPLING_STATE() macro.

Source/Platform:

* chromium/public/Platform.h:
(Platform):
(WebKit::Platform::getTraceSamplingState):

Source/WebCore:

No tests. The sampling profiler is not enabled in Chrome by default.
I manually inserted TRACE_EVENT_SAMPLING_STATE() macros and
confirmed that the sampling profiling is working as expected.

* platform/EventTracer.cpp:
(WebCore::EventTracer::initialize):
(WebCore::EventTracer::getTraceCategoryEnabledFlag):
(WebCore):
* platform/EventTracer.h:
(WebCore):
(EventTracer):
* platform/chromium/EventTracerChromium.cpp:
(WebCore):
(WebCore::EventTracer::initialize):
* platform/chromium/TraceEvent.h:

Source/WebKit/chromium:

* src/WebKit.cpp:
(WebKit::initializeWithoutV8):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144701 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/Platform/ChangeLog
Source/Platform/chromium/public/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/platform/EventTracer.cpp
Source/WebCore/platform/EventTracer.h
Source/WebCore/platform/chromium/EventTracerChromium.cpp
Source/WebCore/platform/chromium/TraceEvent.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebKit.cpp