3 ** Copyright Kepler Project 2005-2007 (http://www.keplerproject.org/luaprofiler)
4 ** $Id: function_meter.h,v 1.5 2007/08/22 19:23:53 carregal Exp $
7 /*****************************************************************************
9 Module to compute the times for functions (local times and total times)
12 'lprofM_init' set up the function times meter service
13 'lprofM_enter_function' called when the function stack increases one level
14 'lprofM_leave_function' called when the function stack decreases one level
16 'lprofM_resume_function' called when the profiler is returning from a time
18 'lprofM_resume_total_time' idem
19 'lprofM_resume_local_time' called when a child function returns the execution
20 to it's caller (current function)
21 'lprofM_pause_function' called when the profiler need to do things that
22 may take too long (writing a log, for example)
23 'lprofM_pause_total_time' idem
24 'lprofM_pause_local_time' called when the current function has called
25 another one or when the function terminates
26 *****************************************************************************/
31 /* compute the local time for the current function */
32 void lprofM_pause_local_time(lprofP_STATE
* S
);
34 /* pause the total timer for all the functions that are in the stack */
35 void lprofM_pause_total_time(lprofP_STATE
* S
);
37 /* pause the local and total timers for all functions in the stack */
38 void lprofM_pause_function(lprofP_STATE
* S
);
40 /* resume the local timer for the current function */
41 void lprofM_resume_local_time(lprofP_STATE
* S
);
43 /* resume the total timer for all the functions in the stack */
44 void lprofM_resume_total_time(lprofP_STATE
* S
);
46 /* resume the local and total timers for all functions in the stack */
47 void lprofM_resume_function(lprofP_STATE
* S
);
49 /* the local time for the parent function is paused */
50 /* and the local and total time markers are started */
51 void lprofM_enter_function(lprofP_STATE
* S
, char *file_defined
, char *fcn_name
, long linedefined
, long currentline
);
53 /* computes times and remove the top of the stack */
54 /* 'isto_resume' specifies if the parent function's timer */
55 /* should be restarted automatically. If it's false, */
56 /* 'resume_local_time()' must be called when the resume */
58 /* returns the funcinfo structure */
59 /* warning: use it before another call to this function, */
60 /* because the funcinfo will be overwritten */
61 lprofS_STACK_RECORD
*lprofM_leave_function(lprofP_STATE
* S
, int isto_resume
);
64 lprofP_STATE
* lprofM_init();