Commit f8b16dbd authored by Kevin Modzelewski's avatar Kevin Modzelewski

Rename some of the stattimers

I renamed all the "about to enter jitted code" and "about to enter the interpreter"
stats to "in_jitted_code" and "in_interpreter", respectively; I don't think the
exact entry point ends up mattering that much.

A lot of stuff is showing up as "in_jitted_code"; I tried to find some of it using
the new itimer helper, and put some separate timers on those.
parent fa30790c
...@@ -386,7 +386,7 @@ Value ASTInterpreter::executeInner(ASTInterpreter& interpreter, CFGBlock* start_ ...@@ -386,7 +386,7 @@ Value ASTInterpreter::executeInner(ASTInterpreter& interpreter, CFGBlock* start_
} }
Value ASTInterpreter::execute(ASTInterpreter& interpreter, CFGBlock* start_block, AST_stmt* start_at) { Value ASTInterpreter::execute(ASTInterpreter& interpreter, CFGBlock* start_block, AST_stmt* start_at) {
UNAVOIDABLE_STAT_TIMER(t0, "us_timer_astinterpreter_execute"); UNAVOIDABLE_STAT_TIMER(t0, "us_timer_in_interpreter");
RegisterHelper frame_registerer; RegisterHelper frame_registerer;
...@@ -605,7 +605,7 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) { ...@@ -605,7 +605,7 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) {
arg_array.push_back(it.second); arg_array.push_back(it.second);
} }
UNAVOIDABLE_STAT_TIMER(t0, "us_timer_astinterpreter_jump_osrexit"); UNAVOIDABLE_STAT_TIMER(t0, "us_timer_in_jitted_code");
CompiledFunction* partial_func = compilePartialFuncInternal(&exit); CompiledFunction* partial_func = compilePartialFuncInternal(&exit);
auto arg_tuple = getTupleFromArgsArray(&arg_array[0], arg_array.size()); auto arg_tuple = getTupleFromArgsArray(&arg_array[0], arg_array.size());
Box* r = partial_func->call(std::get<0>(arg_tuple), std::get<1>(arg_tuple), std::get<2>(arg_tuple), Box* r = partial_func->call(std::get<0>(arg_tuple), std::get<1>(arg_tuple), std::get<2>(arg_tuple),
...@@ -1295,7 +1295,7 @@ const void* interpreter_instr_addr = (void*)&ASTInterpreter::executeInner; ...@@ -1295,7 +1295,7 @@ const void* interpreter_instr_addr = (void*)&ASTInterpreter::executeInner;
Box* astInterpretFunction(CompiledFunction* cf, int nargs, Box* closure, Box* generator, Box* globals, Box* arg1, Box* astInterpretFunction(CompiledFunction* cf, int nargs, Box* closure, Box* generator, Box* globals, Box* arg1,
Box* arg2, Box* arg3, Box** args) { Box* arg2, Box* arg3, Box** args) {
UNAVOIDABLE_STAT_TIMER(t0, "us_timer_astInterpretFunction"); UNAVOIDABLE_STAT_TIMER(t0, "us_timer_in_interpreter");
assert((!globals) == cf->clfunc->source->scoping->areGlobalsFromModule()); assert((!globals) == cf->clfunc->source->scoping->areGlobalsFromModule());
bool can_reopt = ENABLE_REOPT && !FORCE_INTERPRETER && (globals == NULL); bool can_reopt = ENABLE_REOPT && !FORCE_INTERPRETER && (globals == NULL);
......
...@@ -362,7 +362,7 @@ static void handle_sigprof(int signum) { ...@@ -362,7 +362,7 @@ static void handle_sigprof(int signum) {
sigprof_pending++; sigprof_pending++;
} }
//#define INVESTIGATE_STAT_TIMER "us_timer_chosen_cf_body_jitted" //#define INVESTIGATE_STAT_TIMER "us_timer_in_jitted_code"
#ifdef INVESTIGATE_STAT_TIMER #ifdef INVESTIGATE_STAT_TIMER
static uint64_t* stat_counter = Stats::getStatCounter(INVESTIGATE_STAT_TIMER); static uint64_t* stat_counter = Stats::getStatCounter(INVESTIGATE_STAT_TIMER);
static void handle_sigprof_investigate_stattimer(int signum) { static void handle_sigprof_investigate_stattimer(int signum) {
......
...@@ -48,7 +48,7 @@ extern "C" inline void* gc_alloc(size_t bytes, GCKind kind_id) { ...@@ -48,7 +48,7 @@ extern "C" inline void* gc_alloc(size_t bytes, GCKind kind_id) {
// This stat timer is quite expensive, not just because this function is extremely hot, // This stat timer is quite expensive, not just because this function is extremely hot,
// but also because it tends to increase the size of this function enough that we can't // but also because it tends to increase the size of this function enough that we can't
// inline it, which is especially useful for this function. // inline it, which is especially useful for this function.
ScopedStatTimer gc_alloc_stattimer(gc_alloc_stattimer_counter); ScopedStatTimer gc_alloc_stattimer(gc_alloc_stattimer_counter, 15);
#endif #endif
size_t alloc_bytes = bytes + sizeof(GCAllocation); size_t alloc_bytes = bytes + sizeof(GCAllocation);
......
...@@ -118,6 +118,8 @@ Box* generatorIter(Box* s) { ...@@ -118,6 +118,8 @@ Box* generatorIter(Box* s) {
// called from both generatorHasNext and generatorSend/generatorNext (but only if generatorHasNext hasn't been called) // called from both generatorHasNext and generatorSend/generatorNext (but only if generatorHasNext hasn't been called)
static void generatorSendInternal(BoxedGenerator* self, Box* v) { static void generatorSendInternal(BoxedGenerator* self, Box* v) {
STAT_TIMER(t0, "us_timer_generator_switching", 0);
if (self->running) if (self->running)
raiseExcHelper(ValueError, "generator already executing"); raiseExcHelper(ValueError, "generator already executing");
...@@ -260,6 +262,8 @@ Box* generatorHasnext(Box* s) { ...@@ -260,6 +262,8 @@ Box* generatorHasnext(Box* s) {
extern "C" Box* yield(BoxedGenerator* obj, Box* value) { extern "C" Box* yield(BoxedGenerator* obj, Box* value) {
STAT_TIMER(t0, "us_timer_generator_switching", 0);
assert(obj->cls == generator_cls); assert(obj->cls == generator_cls);
BoxedGenerator* self = static_cast<BoxedGenerator*>(obj); BoxedGenerator* self = static_cast<BoxedGenerator*>(obj);
self->returnValue = value; self->returnValue = value;
......
...@@ -39,6 +39,8 @@ public: ...@@ -39,6 +39,8 @@ public:
} }
void next() override { void next() override {
STAT_TIMER(t0, "us_timer_iteratorgeneric_next", 0);
assert(iterator); assert(iterator);
Box* hasnext = iterator->hasnextOrNullIC(); Box* hasnext = iterator->hasnextOrNullIC();
if (hasnext) { if (hasnext) {
......
...@@ -128,7 +128,7 @@ static uint64_t* pylt_timer_counter = Stats::getStatCounter("us_timer_PyLt"); ...@@ -128,7 +128,7 @@ static uint64_t* pylt_timer_counter = Stats::getStatCounter("us_timer_PyLt");
#endif #endif
size_t PyHasher::operator()(Box* b) const { size_t PyHasher::operator()(Box* b) const {
#if EXPENSIVE_STAT_TIMERS #if EXPENSIVE_STAT_TIMERS
ScopedStatTimer _st(pyhasher_timer_counter); ScopedStatTimer _st(pyhasher_timer_counter, 10);
#endif #endif
if (b->cls == str_cls) { if (b->cls == str_cls) {
StringHash<char> H; StringHash<char> H;
...@@ -141,7 +141,7 @@ size_t PyHasher::operator()(Box* b) const { ...@@ -141,7 +141,7 @@ size_t PyHasher::operator()(Box* b) const {
bool PyEq::operator()(Box* lhs, Box* rhs) const { bool PyEq::operator()(Box* lhs, Box* rhs) const {
#if EXPENSIVE_STAT_TIMERS #if EXPENSIVE_STAT_TIMERS
ScopedStatTimer _st(pyeq_timer_counter); ScopedStatTimer _st(pyeq_timer_counter, 10);
#endif #endif
int r = PyObject_RichCompareBool(lhs, rhs, Py_EQ); int r = PyObject_RichCompareBool(lhs, rhs, Py_EQ);
...@@ -152,7 +152,7 @@ bool PyEq::operator()(Box* lhs, Box* rhs) const { ...@@ -152,7 +152,7 @@ bool PyEq::operator()(Box* lhs, Box* rhs) const {
bool PyLt::operator()(Box* lhs, Box* rhs) const { bool PyLt::operator()(Box* lhs, Box* rhs) const {
#if EXPENSIVE_STAT_TIMERS #if EXPENSIVE_STAT_TIMERS
ScopedStatTimer _st(pylt_timer_counter); ScopedStatTimer _st(pylt_timer_counter, 10);
#endif #endif
int r = PyObject_RichCompareBool(lhs, rhs, Py_LT); int r = PyObject_RichCompareBool(lhs, rhs, Py_LT);
...@@ -3415,10 +3415,10 @@ Box* callCLFunc(CLFunction* f, CallRewriteArgs* rewrite_args, int num_output_arg ...@@ -3415,10 +3415,10 @@ Box* callCLFunc(CLFunction* f, CallRewriteArgs* rewrite_args, int num_output_arg
// distinguish lexically between calls that target jitted python // distinguish lexically between calls that target jitted python
// code and calls that target to builtins. // code and calls that target to builtins.
if (f->source) { if (f->source) {
UNAVOIDABLE_STAT_TIMER(t0, "us_timer_chosen_cf_body_jitted"); UNAVOIDABLE_STAT_TIMER(t0, "us_timer_in_jitted_code");
r = callChosenCF(chosen_cf, closure, generator, oarg1, oarg2, oarg3, oargs); r = callChosenCF(chosen_cf, closure, generator, oarg1, oarg2, oarg3, oargs);
} else { } else {
UNAVOIDABLE_STAT_TIMER(t0, "us_timer_chosen_cf_body_builtins"); UNAVOIDABLE_STAT_TIMER(t0, "us_timer_in_builtins");
r = callChosenCF(chosen_cf, closure, generator, oarg1, oarg2, oarg3, oargs); r = callChosenCF(chosen_cf, closure, generator, oarg1, oarg2, oarg3, oargs);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment