]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/debug.h
2 * Copyright 2005, 2016. Rene Rivera
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
11 #include "constants.h"
15 typedef struct profile_info
17 /* name of rule being called */
19 /* cumulative time spent in rule, in seconds */
21 /* time spent in rule proper, in seconds */
23 /* number of time rule was entered */
24 unsigned long num_entries
;
25 /* number of the times this function is present in stack */
26 unsigned long stack_count
;
27 /* memory allocated by the call, in KiB */
31 typedef struct profile_frame
33 /* permanent storage where data accumulates */
35 /* overhead for profiling in this call */
37 /* time of last entry to rule */
39 /* stack frame of caller */
40 struct profile_frame
* caller
;
41 /* time spent in subrules */
45 profile_frame
* profile_init( OBJECT
* rulename
, profile_frame
* );
46 void profile_enter( OBJECT
* rulename
, profile_frame
* );
47 void profile_memory( long mem
);
48 void profile_exit( profile_frame
* );
50 double profile_clock();
52 #define PROFILE_ENTER( scope ) profile_frame PROF_ ## scope, *PROF_ ## scope ## _p = profile_init( constant_ ## scope, &PROF_ ## scope )
53 #define PROFILE_EXIT( scope ) profile_exit( PROF_ ## scope ## _p )
55 OBJECT
* profile_make_local( char const * );
56 #define PROFILE_ENTER_LOCAL( scope ) \
57 static OBJECT * constant_LOCAL_##scope = 0; \
58 if (DEBUG_PROFILE && !constant_LOCAL_##scope) constant_LOCAL_##scope = profile_make_local( #scope ); \
59 PROFILE_ENTER( LOCAL_##scope )
60 #define PROFILE_EXIT_LOCAL( scope ) PROFILE_EXIT( LOCAL_##scope )