Sampling profiler for chrome://tracing

Allows using TRACE_EVENT_STATE to set a current state. This state is encoded as a static const string pointer. Using the macro stores the static string pointer to a global.

While tracing is active, a background thread is spun up and samples this global at a regular interval.

The motivation (as compared with other TRACE_EVENT_* macros) is that the runtime cost is lower (in both the disabled and enabled state), at a cost of lower accuracy and less information gathered.

A "normal" sampling profiler would try to sample the program counter instead, however, this induces the cost of suspending the target thread(s), whereas this approach only adds the constant overhead of storing to a global.

Currently, in chrome://tracing the data shows up as a fake thread containing only one event which contains the sampling data as an "instant" event. This UI will be improved in future patches.


BUG=

Review URL: https://chromiumcodereview.appspot.com/12224011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184542 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed