2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_WORKLOAD_STATS_H_
18 #define incl_HPHP_WORKLOAD_STATS_H_
22 // WorkloadStats is used to track per request timing for different states
23 // of the VM. At the entrypoint to a change of vm state a WorkloadStats object
24 // should be made to guard the state change with appropriate timers and
27 // The states tracked are:
28 // - In a request (this is a superset of the interpreter state)
29 // - In the interpreter through Dispatch, or DispatchBB (interpOne disregarded)
30 // - In the JIT (currently tracks time inside the translate routine)
32 // Note the time in the TC is not tracked. This is roughly:
33 // Time in request - Time in interp
35 // This gives us the relative interp time formula of:
36 // Relative interp time = Time in interp / Time in request
37 struct WorkloadStats final
{
40 // -> InInterp Okay (entering Dispatch loop)
41 // -> InTrans Okay (entering translate)
43 // -> InRequest Okay (leaving the dispatch loop)
44 // -> InTrans Okay (entering translate)
46 // -> InRequest Okay (leaving translate)
47 // -> InInterp Okay (leaving translate)
50 explicit WorkloadStats(State guardedState
);
53 WorkloadStats (const WorkloadStats
&) = delete;
54 WorkloadStats
& operator=(const WorkloadStats
&) = delete;