beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / luaprofiler / function_meter.h
blobd2eb5a7ca71cef2e40f57e64ce14f83f5bd4a3b3
1 /*
2 ** LuaProfiler
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 $
5 */
7 /*****************************************************************************
8 function_meter.c:
9 Module to compute the times for functions (local times and total times)
11 Design:
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
17 consuming task
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 *****************************************************************************/
28 #include "stack.h"
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 */
57 /* should be done */
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);
63 /* init stack */
64 lprofP_STATE* lprofM_init();