/Util/EventTimer.h
http://unladen-swallow.googlecode.com/ · C Header · 61 lines · 45 code · 12 blank · 4 comment · 0 complexity · 9cf3b2465514fa772511b7c300a19fca MD5 · raw file
- #ifndef UTIL_EVENTTIMER_H
- #define UTIL_EVENTTIMER_H
- #include "Python.h"
- #ifdef WITH_TSC
- /* This must be kept in sync with event_names in EventTimer.cc */
- typedef enum {
- CALL_START_EVAL, // Top of CALL_FUNCTION_* opcodes
- CALL_START_LLVM, // Top of CALL_FUNCTION_* LLVM IRs
- CALL_ENTER_EVAL, // Top of PyEval_EvalFrame
- CALL_ENTER_PYOBJ_CALL, // Any call to PyObject_Call from eval.cc
- CALL_ENTER_C, // Before calling C methods in eval.cc
- CALL_ENTER_LLVM, // Top of function entry block in LLVM
- CALL_END_EVAL, // Bottom of CALL_FUNCTION* opcodes
- LLVM_COMPILE_START, // Before JITing or looking up native code
- LLVM_COMPILE_END, // After JITing or looking up native code
- JIT_START, // Start of LLVM jitting
- JIT_END, // End of LLVM jitting
- EXCEPT_RAISE_EVAL, // Exception raised in eval loop
- EXCEPT_RAISE_LLVM, // Exception raised in LLVM
- EXCEPT_CATCH_EVAL, // Exception caught in eval loop
- EXCEPT_CATCH_LLVM, // Exception caught in LLVM
- LOAD_GLOBAL_ENTER_EVAL, // Start of a LOAD_GLOBAL opcode in the eval loop
- LOAD_GLOBAL_EXIT_EVAL, // End of a LOAD_GLOBAL opcode in the eval loop
- LOAD_GLOBAL_ENTER_LLVM, // Start of a LOAD_GLOBAL opcode in LLVM
- LOAD_GLOBAL_EXIT_LLVM, // End of a LOAD_GLOBAL opcode in LLVM
- EVAL_COMPILE_START, // Start of the entire compilation in eval loop
- EVAL_COMPILE_END, // End of the entire compilation in eval loop
- FLUSH_START, // Start of the TSC event flush
- FLUSH_END, // Enf of the TSC event flush
- } _PyTscEventId;
- typedef unsigned PY_LONG_LONG tsc_t;
- typedef struct {
- long thread_id;
- _PyTscEventId event_id;
- tsc_t time;
- } _PyTscEvent;
- /* Log an event and the TSC when it occurred. */
- #ifdef __cplusplus
- extern "C" PyAPI_FUNC(void) _PyLog_TscEvent(_PyTscEventId event);
- #else
- extern PyAPI_FUNC(void) _PyLog_TscEvent(_PyTscEventId event);
- #endif
- /* Simple macro that wraps up the ifdef WITH_TSC check so that callers don't
- have to spell it out in their code. */
- #define PY_LOG_TSC_EVENT(event) _PyLog_TscEvent(event)
- #else
- #define PY_LOG_TSC_EVENT(event)
- #endif /* WITH_TSC */
- #endif /* UTIL_EVENTTIMER_H */