diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 19:24:24 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 19:24:24 +0000 |
commit | 01699e2ae35826dc3d16ef6c828c721144443fdd (patch) | |
tree | d9f334be31f6dadefef1b0d66cce1f225f315368 /webkit/tools/test_shell/test_shell_main.cc | |
parent | 46d614ab071ce85f57c8099cf8157d104e7fc2fc (diff) | |
download | chromium_src-01699e2ae35826dc3d16ef6c828c721144443fdd.zip chromium_src-01699e2ae35826dc3d16ef6c828c721144443fdd.tar.gz chromium_src-01699e2ae35826dc3d16ef6c828c721144443fdd.tar.bz2 |
linux: TCMalloc-based C++ heap profiler.
Requires compiling with linux_use_tcmalloc=1.
When enabled by --heap-profiler flag in test_shell exposes
chromium.HeapProfiler object to JavaScript. The object has three
methods:
o start() -- starts profiling
o dump() -- dumps data accumulated since start() to file
named like chromium-YYYY-MM-DD-TS.heap
o stop() -- stops profiling.
Output can be analyzed by third_party/tcmalloc/tcmalloc/src/pprof.
For example:
$ third_party/tcmalloc/tcmalloc/src/pprof \
sconsbuild/Release/test_shell \
chromium-2009-11-06-1234567890.heap
See http://code.google.com/p/google-perftools/ for details on how to
use pprof.
Patch contributed by vitalyr@chromium.org. Original review at
http://codereview.chromium.org/377010/show.
TBR=vitalyr
Review URL: http://codereview.chromium.org/390015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31688 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_shell_main.cc')
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index b069b2f..ea2d625 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -29,6 +29,7 @@ #include "webkit/glue/webkit_glue.h" #include "webkit/glue/window_open_disposition.h" #include "webkit/extensions/v8/gc_extension.h" +#include "webkit/extensions/v8/heap_profiler_extension.h" #include "webkit/extensions/v8/playback_extension.h" #include "webkit/extensions/v8/profiler_extension.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" @@ -225,6 +226,11 @@ int main(int argc, char* argv[]) { extensions_v8::ProfilerExtension::Get()); } + if (parsed_command_line.HasSwitch(test_shell::kHeapProfiler)) { + WebScriptController::registerExtension( + extensions_v8::HeapProfilerExtension::Get()); + } + // Load and initialize the stats table. Attempt to construct a somewhat // unique name to isolate separate instances from each other. StatsTable *table = new StatsTable( |