pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:3362:
/* These are cleared when filename and lineno have been initialized * from them. */ PIKEVAR program prog flags ID_PROTECTED|ID_PRIVATE; CVAR PIKE_OPCODE_T *pc; /* These two are considered to be uninitialized from prog, pc and * fun as long as lineno == 0. */ 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 { THIS->pc = NULL; THIS->lineno = 0; THIS->filename = NULL; } #endif EXIT
pike.git/src/builtin.cmod:3719:
*/ PIKECLASS LiveBacktraceFrame { /*! @decl @Annotations.Implements(BacktraceFrame) */ IMPLEMENTS backtrace_frame; /* 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; /* Cached result of low_get_line(). lineno == 0 indicates * that the values are stale. */ CVAR struct pike_string *filename; CVAR INT_TYPE lineno; CVAR struct local_variable_info locals;
pike.git/src/builtin.cmod:4017:
PIKEFUN int(0..) `num_locals() { struct pike_frame *fp = THIS->fp; if (!fp) { push_undefined(); } else { push_int(fp->num_locals); } }
+
#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; if (!fp || (l >= fp->num_locals)) { Pike_error("No such local: #%d\n", l); } push_svalue(fp->locals + l); } PIKEFUN mixed set_local(int(0..) l, mixed val)
pike.git/src/builtin.cmod:4204:
struct LiveBacktraceFrame_struct *bf; o = fast_clone_object(LiveBacktraceFrame_program); bf = OBJ2_LIVEBACKTRACEFRAME(o); SET_SVAL(res->item[size], PIKE_T_OBJECT, 0, object, o); 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; } o = fast_clone_object(backtrace_frame_program); SET_SVAL(res->item[size], PIKE_T_OBJECT, 0, object, o); 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) { if (f->pc == (void *)do_gc) { SET_SVAL(bf->_fun, PIKE_T_STRING, 0, string, make_shared_string("gc")); } else if (f->pc == (void *)pike_do_exit) { SET_SVAL(bf->_fun, PIKE_T_STRING, 0, string, make_shared_string("exit")); } continue;