PageRenderTime 303ms CodeModel.GetById 161ms app.highlight 3ms RepoModel.GetById 137ms app.codeStats 0ms

/Util/EventTimer.h

http://unladen-swallow.googlecode.com/
C++ Header | 61 lines | 45 code | 12 blank | 4 comment | 0 complexity | 9cf3b2465514fa772511b7c300a19fca MD5 | raw file
 1#ifndef UTIL_EVENTTIMER_H
 2#define UTIL_EVENTTIMER_H
 3
 4#include "Python.h"
 5
 6
 7#ifdef WITH_TSC
 8
 9/* This must be kept in sync with event_names in EventTimer.cc */
10typedef enum {
11    CALL_START_EVAL,        // Top of CALL_FUNCTION_* opcodes
12    CALL_START_LLVM,        // Top of CALL_FUNCTION_* LLVM IRs
13    CALL_ENTER_EVAL,        // Top of PyEval_EvalFrame
14    CALL_ENTER_PYOBJ_CALL,  // Any call to PyObject_Call from eval.cc
15    CALL_ENTER_C,           // Before calling C methods in eval.cc
16    CALL_ENTER_LLVM,        // Top of function entry block in LLVM
17    CALL_END_EVAL,          // Bottom of CALL_FUNCTION* opcodes
18    LLVM_COMPILE_START,     // Before JITing or looking up native code
19    LLVM_COMPILE_END,       // After JITing or looking up native code
20    JIT_START,              // Start of LLVM jitting
21    JIT_END,                // End of LLVM jitting
22    EXCEPT_RAISE_EVAL,      // Exception raised in eval loop
23    EXCEPT_RAISE_LLVM,      // Exception raised in LLVM
24    EXCEPT_CATCH_EVAL,      // Exception caught in eval loop
25    EXCEPT_CATCH_LLVM,      // Exception caught in LLVM
26    LOAD_GLOBAL_ENTER_EVAL, // Start of a LOAD_GLOBAL opcode in the eval loop
27    LOAD_GLOBAL_EXIT_EVAL,  // End of a LOAD_GLOBAL opcode in the eval loop
28    LOAD_GLOBAL_ENTER_LLVM, // Start of a LOAD_GLOBAL opcode in LLVM
29    LOAD_GLOBAL_EXIT_LLVM,  // End of a LOAD_GLOBAL opcode in LLVM
30    EVAL_COMPILE_START,     // Start of the entire compilation in eval loop
31    EVAL_COMPILE_END,       // End of the entire compilation in eval loop
32    FLUSH_START,            // Start of the TSC event flush
33    FLUSH_END,              // Enf of the TSC event flush
34} _PyTscEventId;
35
36typedef unsigned PY_LONG_LONG tsc_t;
37
38typedef struct {
39    long thread_id;
40    _PyTscEventId event_id;
41    tsc_t time;
42} _PyTscEvent;
43
44/* Log an event and the TSC when it occurred. */
45#ifdef __cplusplus
46extern "C" PyAPI_FUNC(void) _PyLog_TscEvent(_PyTscEventId event);
47#else
48extern PyAPI_FUNC(void) _PyLog_TscEvent(_PyTscEventId event);
49#endif
50
51/* Simple macro that wraps up the ifdef WITH_TSC check so that callers don't
52   have to spell it out in their code. */
53#define PY_LOG_TSC_EVENT(event) _PyLog_TscEvent(event)
54
55#else
56
57#define PY_LOG_TSC_EVENT(event)
58
59#endif  /* WITH_TSC */
60
61#endif  /* UTIL_EVENTTIMER_H */