Branch: Tag:

2021-11-05

2021-11-05 09:47:12 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Pike.BacktraceFrame: Add field total_time --with-profiling.

3369:    CVAR struct pike_string *filename;    CVAR INT_TYPE lineno;    + #ifdef PROFILING +  PIKEVAR bignum total_time; +  /* FIXME: self_time */ + #endif +  +  DECLARE_STORAGE; +    #ifdef PIKE_NULL_IS_SPECIAL    INIT    {
3726:    /* The live frame to inspect. */    CVAR struct pike_frame *fp;    -  /* FIXME: Keep track of the corresponding thread? */ +  /* The thread that owns the frame. +  * +  * NB: This is required for PROFILING, but may be useful +  * in other cases too. +  */ +  PIKEVAR object thread_obj flags ID_PRIVATE; +  CVAR struct thread_state *thread_state;       /* fp->pc when low_get_line() was last called. */    CVAR PIKE_OPCODE_T *pc;
4024:    }    }    + #ifdef PROFILING +  PIKEFUN int `total_time() +  { +  struct pike_frame *fp = THIS->fp; +  if (!fp || !THIS->thread_state) { +  push_undefined(); +  } else { +  push_int64(get_cpu_time() - +  (THIS->thread_state->state.unlocked_time + fp->start_time)); +  } +  } + #endif +     PIKEFUN mixed get_local(int(0..) l)    {    struct pike_frame *fp = THIS->fp;
4211:       add_ref(bf->fp = f);    +  if ((bf->thread_state = i->thread_state)) { +  add_ref(bf->thread_obj = i->thread_state->thread_obj); +  } +     /* FIXME: Keep track of the corresponding thread? */       continue;
4222:       bf = OBJ2_BACKTRACE_FRAME(o);    + #ifdef PROFILING +  push_int64(get_cpu_time() - (i->unlocked_time + f->start_time)); +  bf->total_time = Pike_sp[-1]; +  Pike_sp--; + #endif +     SET_SVAL(bf->_fun, PIKE_T_INT, NUMBER_DESTRUCTED, integer, 0);       if (!f->context) {