def get_stats_snapshot(space): """ Get the jit status in the specific moment in time. Note that this is eager - the attribute access is not lazy, if you need new stats you need to call this function again. """ ll_times = jit_hooks.stats_get_loop_run_times(None) w_times = space.newdict() for i in range(len(ll_times)): w_key = space.newtuple([space.wrap(ll_times[i].type), space.wrap(ll_times[i].number)]) space.setitem(w_times, w_key, space.wrap(ll_times[i].counter)) w_counters = space.newdict() for i, counter_name in enumerate(Counters.counter_names): v = jit_hooks.stats_get_counter_value(None, i) space.setitem_str(w_counters, counter_name, space.wrap(v)) w_counter_times = space.newdict() tr_time = jit_hooks.stats_get_times_value(None, Counters.TRACING) space.setitem_str(w_counter_times, "TRACING", space.wrap(tr_time)) b_time = jit_hooks.stats_get_times_value(None, Counters.BACKEND) space.setitem_str(w_counter_times, "BACKEND", space.wrap(b_time)) return space.wrap(W_JitInfoSnapshot(space, w_times, w_counters, w_counter_times))
def main(b): jit_hooks.stats_set_debug(None, b) loop(30) l = jit_hooks.stats_get_loop_run_times(None) if b: assert len(l) == 4 # completely specific test that would fail each time # we change anything major. for now it's 4 # (loop, bridge, 2 entry points) assert l[0].type == 'e' assert l[0].number == 0 assert l[0].counter == 4 assert l[1].type == 'l' assert l[1].counter == 4 assert l[2].type == 'l' assert l[2].counter == 23 assert l[3].type == 'b' assert l[3].number == 4 assert l[3].counter == 11 else: assert len(l) == 0
def get_stats_snapshot(space): """ Get the jit status in the specific moment in time. Note that this is eager - the attribute access is not lazy, if you need new stats you need to call this function again. """ ll_times = jit_hooks.stats_get_loop_run_times(None) w_times = space.newdict() for i in range(len(ll_times)): w_key = space.newtuple( [space.wrap(ll_times[i].type), space.wrap(ll_times[i].number)]) space.setitem(w_times, w_key, space.wrap(ll_times[i].counter)) w_counters = space.newdict() for i, counter_name in enumerate(Counters.counter_names): v = jit_hooks.stats_get_counter_value(None, i) space.setitem_str(w_counters, counter_name, space.wrap(v)) w_counter_times = space.newdict() tr_time = jit_hooks.stats_get_times_value(None, Counters.TRACING) space.setitem_str(w_counter_times, 'TRACING', space.wrap(tr_time)) b_time = jit_hooks.stats_get_times_value(None, Counters.BACKEND) space.setitem_str(w_counter_times, 'BACKEND', space.wrap(b_time)) return space.wrap( W_JitInfoSnapshot(space, w_times, w_counters, w_counter_times))
def main(): jit_hooks.stats_set_debug(None, True) f() ll_times = jit_hooks.stats_get_loop_run_times(None) return len(ll_times)