Add ProfilerMwprof
authorOri Livneh <ori@wikimedia.org>
Mon, 6 Jan 2014 21:24:44 +0000 (13:24 -0800)
committerOri Livneh <ori@wikimedia.org>
Tue, 7 Jan 2014 21:03:11 +0000 (13:03 -0800)
commitc5e6ce0f9e4d593a4cb8c58e7da4a3b3477c4e5c
treead254364dcf2951c47f71d78bd8bade7aa70c09f
parent92e97e784d5787e99a6d4cffdf5e703045c357b9
Add ProfilerMwprof

ProfilerMwprof is similar to ProfilerSimpleUDP in that accumulated profiling
samples are emitted to a remote host using UDP. Profiling data for sections
that are called multiple times are aggregating using the RunningStat class I
introduced in Ifedda276d; this provides the ability to compute timing variance
across multiple requests without storing individual values for a second pass
through the data.

Entries are serialized into MessagePack arrays, using the implementation added
in Id2833c5a9. The first element of each array is an entry type specifier.
Currently two types exist: TYPE_SINGLE (single sample; no statistical moments)
and TYPE_RUNNING (aggregated entry with statistical moments). Additional entry
formats may be specified in the future.

TYPE_SINGLE entries have the format:

  [ TYPE_SINGLE, name (string), CPU time (float), wall time (float ]

TYPE_RUNNING entries have the format:

  [ TYPE_RUNNING, name (string), count (int),
    CPU m1 (float), CPU m2 (float), CPU min (float), CPU max (float),
    wall m1 (float), wall m2 (float), wall min (float), wall max (float) ]

To help reviewers test this change, I have a trivial Python script that can
serve as the back-end: <https://gist.github.com/atdt/8290191>

Change-Id: I688e7231dad9fcc9d29954afacc47f55d521f58d
includes/AutoLoader.php
includes/profiler/ProfilerMwprof.php [new file with mode: 0644]