|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef BJAM_DEBUG_H |
|
#define BJAM_DEBUG_H |
|
|
|
#include "constants.h" |
|
#include "object.h" |
|
#include <time.h> |
|
|
|
|
|
typedef struct profile_info |
|
{ |
|
|
|
OBJECT * name; |
|
|
|
clock_t cumulative; |
|
|
|
clock_t net; |
|
|
|
unsigned long num_entries; |
|
|
|
unsigned long stack_count; |
|
|
|
unsigned long memory; |
|
} profile_info; |
|
|
|
typedef struct profile_frame |
|
{ |
|
|
|
profile_info * info; |
|
|
|
clock_t overhead; |
|
|
|
clock_t entry_time; |
|
|
|
struct profile_frame * caller; |
|
|
|
clock_t subrules; |
|
} profile_frame; |
|
|
|
profile_frame * profile_init( OBJECT * rulename, profile_frame * ); |
|
void profile_enter( OBJECT * rulename, profile_frame * ); |
|
void profile_memory( long mem ); |
|
void profile_exit( profile_frame * ); |
|
void profile_dump(); |
|
|
|
#define PROFILE_ENTER( scope ) profile_frame PROF_ ## scope, *PROF_ ## scope ## _p = profile_init( constant_ ## scope, &PROF_ ## scope ) |
|
#define PROFILE_EXIT( scope ) profile_exit( PROF_ ## scope ## _p ) |
|
|
|
#endif |
|
|