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_
}
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;
......@@ -605,7 +605,7 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) {
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);
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),
......@@ -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* 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());
bool can_reopt = ENABLE_REOPT && !FORCE_INTERPRETER && (globals == NULL);
......
......@@ -362,7 +362,7 @@ static void handle_sigprof(int signum) {
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
static uint64_t* stat_counter = Stats::getStatCounter(INVESTIGATE_STAT_TIMER);
static void handle_sigprof_investigate_stattimer(int signum) {
......
......@@ -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,
// 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.
ScopedStatTimer gc_alloc_stattimer(gc_alloc_stattimer_counter);
ScopedStatTimer gc_alloc_stattimer(gc_alloc_stattimer_counter, 15);
#endif
size_t alloc_bytes = bytes + sizeof(GCAllocation);
......
......@@ -118,6 +118,8 @@ Box* generatorIter(Box* s) {
// called from both generatorHasNext and generatorSend/generatorNext (but only if generatorHasNext hasn't been called)
static void generatorSendInternal(BoxedGenerator* self, Box* v) {
STAT_TIMER(t0, "us_timer_generator_switching", 0);
if (self->running)
raiseExcHelper(ValueError, "generator already executing");
......@@ -260,6 +262,8 @@ Box* generatorHasnext(Box* s) {
extern "C" Box* yield(BoxedGenerator* obj, Box* value) {
STAT_TIMER(t0, "us_timer_generator_switching", 0);
assert(obj->cls == generator_cls);
BoxedGenerator* self = static_cast<BoxedGenerator*>(obj);
self->returnValue = value;
......
......@@ -39,6 +39,8 @@ public:
}
void next() override {
STAT_TIMER(t0, "us_timer_iteratorgeneric_next", 0);
assert(iterator);
Box* hasnext = iterator->hasnextOrNullIC();
if (hasnext) {
......
......@@ -128,7 +128,7 @@ static uint64_t* pylt_timer_counter = Stats::getStatCounter("us_timer_PyLt");
#endif
size_t PyHasher::operator()(Box* b) const {
#if EXPENSIVE_STAT_TIMERS
ScopedStatTimer _st(pyhasher_timer_counter);
ScopedStatTimer _st(pyhasher_timer_counter, 10);
#endif
if (b->cls == str_cls) {
StringHash<char> H;
......@@ -141,7 +141,7 @@ size_t PyHasher::operator()(Box* b) const {
bool PyEq::operator()(Box* lhs, Box* rhs) const {
#if EXPENSIVE_STAT_TIMERS
ScopedStatTimer _st(pyeq_timer_counter);
ScopedStatTimer _st(pyeq_timer_counter, 10);
#endif
int r = PyObject_RichCompareBool(lhs, rhs, Py_EQ);
......@@ -152,7 +152,7 @@ bool PyEq::operator()(Box* lhs, Box* rhs) const {
bool PyLt::operator()(Box* lhs, Box* rhs) const {
#if EXPENSIVE_STAT_TIMERS
ScopedStatTimer _st(pylt_timer_counter);
ScopedStatTimer _st(pylt_timer_counter, 10);
#endif
int r = PyObject_RichCompareBool(lhs, rhs, Py_LT);
......@@ -3415,10 +3415,10 @@ Box* callCLFunc(CLFunction* f, CallRewriteArgs* rewrite_args, int num_output_arg
// distinguish lexically between calls that target jitted python
// code and calls that target to builtins.
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);
} 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);
}
......
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