[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/Source/Platform/chromium/public@144701 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 file changed