[Tizen_6_build] Fixed 32-bit arm build with gcc 9
[platform/upstream/boost-jam.git] / debug.h
1 /*
2     Copyright Rene Rivera 2005.
3     Distributed under the Boost Software License, Version 1.0.
4     (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5 */
6 #ifndef BJAM_DEBUG_H
7 #define BJAM_DEBUG_H
8
9 #include "jam.h"
10 #include <time.h>
11
12
13 struct profile_info
14 {
15     /* name of rule being called */
16     char* name;
17     /* cumulative time spent in rule */
18     clock_t cumulative;
19     /* time spent in rule proper */
20     clock_t net;
21     /* number of time rule was entered */
22     unsigned long num_entries;
23     /* number of the times this function is present in stack */
24     unsigned long stack_count;
25     /* bytes of memory allocated by the call */
26     unsigned long memory;
27 };
28 typedef struct profile_info profile_info;
29
30 struct profile_frame
31 {
32     /* permanent storage where data accumulates */
33     profile_info* info;
34     /* overhead for profiling in this call */
35     clock_t overhead;
36     /* time of last entry to rule */
37     clock_t entry_time;
38     /* stack frame of caller */
39     struct profile_frame* caller;
40     /* time spent in subrules */
41     clock_t subrules;
42 };
43 typedef struct profile_frame profile_frame;
44
45 profile_frame * profile_init( char * rulename, profile_frame * frame );
46 void profile_enter( char* rulename, profile_frame * frame );
47 void profile_memory( long mem );
48 void profile_exit( profile_frame * frame );
49 void profile_dump();
50
51 #define PROFILE_ENTER( scope ) profile_frame PROF_ ## scope, *PROF_ ## scope ## _p = profile_init( #scope, &PROF_ ## scope )
52 #define PROFILE_EXIT( scope ) profile_exit( PROF_ ## scope ## _p )
53
54 #endif