2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-14 12:42:11 +00:00
Files
build/src/engine/debug.h
Rene Rivera eed0cf6cc3 Variety of performance improvements.
* bjam; bump to version 3.1.12
* bjam; make it possible to build in MinGW/MSYS shell
* bjam; move profile code to debug.h/c to make it available for use everywhere
* bjam; cache all filesystem query operations, Unix and Windows only, include PWD and scanning
* bjam; add memory profile info, and sprinkle throught code
* bbv2; rewrite some while() loops into for() loops to reduce time and memory
* bbv2; keep a single instance counter instead of one per type to reduce memory use
* bjam+bbv2; change NORMALIZE_PATH builtin to join path parts to reduce memory use


[SVN r31177]
2005-10-03 00:47:36 +00:00

54 lines
1.5 KiB
C

/*
Copyright Rene Rivera 2005.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BJAM_DEBUG_H
#define BJAM_DEBUG_H
# include "jam.h"
# include <time.h>
struct profile_info
{
/* name of rule being called */
char* name;
/* cumulative time spent in rule */
clock_t cumulative;
/* time spent in rule proper */
clock_t net;
/* number of time rule was entered */
unsigned long num_entries;
/* number of the times this function is present in stack */
unsigned long stack_count;
/* bytes of memory allocated by the call */
unsigned long memory;
};
typedef struct profile_info profile_info;
struct profile_frame
{
/* permanent storage where data accumulates */
profile_info* info;
/* overhead for profiling in this call */
clock_t overhead;
/* time of last entry to rule */
clock_t entry_time;
/* stack frame of caller */
struct profile_frame* caller;
/* time spent in subrules */
clock_t subrules;
};
typedef struct profile_frame profile_frame;
profile_frame * profile_init( char* rulename, profile_frame* frame );
void profile_enter( char* rulename, profile_frame* frame );
void profile_memory( long mem );
void profile_exit(profile_frame* frame);
void profile_dump();
#define PROFILE_ENTER(scope) profile_frame PROF_ ## scope, *PROF_ ## scope ## _p = profile_init(#scope,&PROF_ ## scope)
#define PROFILE_EXIT(scope) profile_exit(PROF_ ## scope ## _p)
#endif