]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/debug.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / build / src / engine / debug.h
1 /*
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)
6 */
7
8 #ifndef BJAM_DEBUG_H
9 #define BJAM_DEBUG_H
10
11 #include "constants.h"
12 #include "object.h"
13
14
15 typedef struct profile_info
16 {
17 /* name of rule being called */
18 OBJECT * name;
19 /* cumulative time spent in rule, in seconds */
20 double cumulative;
21 /* time spent in rule proper, in seconds */
22 double net;
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 */
28 double memory;
29 } profile_info;
30
31 typedef struct profile_frame
32 {
33 /* permanent storage where data accumulates */
34 profile_info * info;
35 /* overhead for profiling in this call */
36 double overhead;
37 /* time of last entry to rule */
38 double entry_time;
39 /* stack frame of caller */
40 struct profile_frame * caller;
41 /* time spent in subrules */
42 double subrules;
43 } profile_frame;
44
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 * );
49 void profile_dump();
50 double profile_clock();
51
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 )
54
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 )
61
62 #endif