Revision: 2933
Author: mikhail.naganov
Date: Fri Sep 18 04:22:28 2009
Log: Created wiki page through web user interface.
http://code.google.com/p/v8/source/detail?r=2933
Added:
/wiki/ProfilingChromiumWithV8.wiki
=======================================
--- /dev/null
+++ /wiki/ProfilingChromiumWithV8.wiki Fri Sep 18 04:22:28 2009
@@ -0,0 +1,59 @@
+#summary This page describes how to use V8's CPU & Heap profilers with
Chromium.
+#labels profiler
+
+= Introduction =
+
+V8's CPU & Heap profilers are trivial to use from V8's shells (see
V8Profile), but it may appear confusing how to use them with Chromium. This
page should help you with it.
+
+= Instructions =
+
+== Why using V8's profilers with Chromium is different from using them
with V8 shells? ==
+
+Chromium is a complex application, unlike V8 shells. Below is the list of
Chromium features that affect profiler usage:
+
+ * each renderer is a separate process (OK, not actually each, but let's
omit this detail), so they can't share the same log file;
+ * sandbox built around renderer process prevents it from writing to a
disk;
+ * Developer Tools configure profilers for their own purposes;
+ * V8's logging code contains some optimizations to simplify logging
state checks.
+
+== Recipe ingredients ==
+
+You need to pass several flags to Chromium in order to get the results you
want. Let's discuss each flag in detail.
+
+ * *--no-sandbox* - turns off the renderer sandbox, obviously must have;
+ * *--js-flags* - this is the containers for flags passed to V8:
+ * *--logfile=%t.log* - specifies a name pattern for log files; *%t*
gets expanded into current time in milliseconds, so each process gets its
own log file; you can use prefixes and suffixes if you want, like this:
*prefix-%t-suffix.log*;
+ * *--noprof-lazy* - allows shared libraries entries to be logged upon
CPU profiler initialization;
+ * *--prof-auto* / *--noprof-auto* - controls whether CPU profiling
should start immediately after V8 initialization, or be controlled via
Developer Tools Profiles pane;
+ * *--nocompress-log* - disables log contents compression which makes
them unreadable for humans (but they still can be processed with V8's tick
processor scripts);
+ * *--log-gc* - controls logging of heap contents on garbage
collections (Heap profiling).
+
+== The cookbook ==
+
+Now having an understanding what behavior is controlled by which flag,
let's combine them.
+
+Here is how to run Chromium in order to get a CPU profile from the start
of the process:
+{{{
+./Chromium --no-sandbox --js-flags="--logfile=%t.log --noprof-lazy
--prof-auto"
+}}}
+
+If you want to start / stop CPU profiling manually using Developer Tools
Profiles pane, use *--noprof-auto*:
+{{{
+./Chromium --no-sandbox --js-flags="--logfile=%t.log --noprof-lazy
--noprof-auto"
+}}}
+
+To have heap usage statistics logged continuously, run Chromium like this:
+{{{
+./Chromium --no-sandbox --js-flags="--logfile=%t.log --log-gc"
+}}}
+
+To log heap usage statistics manually using Developer Tools Heap pane:
+{{{
+./Chromium --no-sandbox --js-flags="--logfile=%t.log"
+}}}
+
+Please note that when using manual controls for profiles creation, you
wouldn't see profiles in Developer Tools, because all the data is being
logged to a file, not to Developer Tools.
+
+== Notes ==
+
+Under Windows, be sure to turn on .MAP file creation for *chrome.dll*, but
not for *chrome.exe*.
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---