diff options
Diffstat (limited to 'source3/include/profile.h')
-rw-r--r-- | source3/include/profile.h | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/source3/include/profile.h b/source3/include/profile.h index c196a63c62..b05e1fd9bb 100644 --- a/source3/include/profile.h +++ b/source3/include/profile.h @@ -35,13 +35,11 @@ enum flush_reason_enum { SEEK_FLUSH, READ_FLUSH, WRITE_FLUSH, READRAW_FLUSH, #define PROF_SHMEM_KEY ((key_t)0x07021999) #define PROF_SHM_MAGIC 0x6349985 -#define PROF_SHM_VERSION 2 +#define PROF_SHM_VERSION 3 -/* time values in the following structure are in milliseconds */ +/* time values in the following structure are in microseconds */ -struct profile_struct { - int prof_shm_magic; - int prof_shm_version; +struct profile_stats { /* general counters */ unsigned smb_count; /* how many SMB packets we have processed */ unsigned uid_changes; /* how many times we change our effective uid */ @@ -314,10 +312,18 @@ struct profile_struct { unsigned NT_transact_query_security_desc_time; }; +struct profile_header { + int prof_shm_magic; + int prof_shm_version; + struct profile_stats stats; +}; -extern struct profile_struct *profile_p; +extern struct profile_header *profile_h; +extern struct profile_stats *profile_p; extern struct timeval profile_starttime; extern struct timeval profile_endtime; +extern struct timeval profile_starttime_nested; +extern struct timeval profile_endtime_nested; extern BOOL do_profile_flag; extern BOOL do_profile_times; @@ -328,7 +334,12 @@ extern BOOL do_profile_times; #define INC_PROFILE_COUNT(x) profile_p->x++ #define DEC_PROFILE_COUNT(x) profile_p->x-- #define ADD_PROFILE_COUNT(x,y) profile_p->x += (y) -#define PROFILE_TIME TvalDiff(&profile_starttime,&profile_endtime) +#define PROFILE_TIME \ + ((profile_endtime.tv_sec - profile_starttime.tv_sec) *1000000 + \ + ((int)profile_endtime.tv_usec - (int)profile_starttime.tv_usec)) +#define PROFILE_TIME_NESTED \ + ((profile_endtime_nested.tv_sec - profile_starttime_nested.tv_sec) *1000000 + \ + ((int)profile_endtime_nested.tv_usec - (int)profile_starttime_nested.tv_usec)) #ifdef WITH_PROFILE #define DO_PROFILE_INC(x) \ @@ -354,6 +365,12 @@ extern BOOL do_profile_times; GetTimeOfDay(&profile_starttime); \ INC_PROFILE_COUNT(x##_count); \ } +#define START_PROFILE_NESTED(x) \ + if (do_profile_flag) { \ + if (do_profile_times) \ + GetTimeOfDay(&profile_starttime_nested); \ + INC_PROFILE_COUNT(x##_count); \ + } #define START_PROFILE_BYTES(x,n) \ if (do_profile_flag) { \ if (do_profile_times) \ @@ -366,14 +383,21 @@ extern BOOL do_profile_times; GetTimeOfDay(&profile_endtime); \ ADD_PROFILE_COUNT(x##_time,PROFILE_TIME); \ } +#define END_PROFILE_NESTED(x) \ + if (do_profile_times) { \ + GetTimeOfDay(&profile_endtime_nested); \ + ADD_PROFILE_COUNT(x##_time,PROFILE_TIME_NESTED); \ + } #else #define DO_PROFILE_INC(x) #define DO_PROFILE_DEC(x) #define DO_PROFILE_DEC_INC(x,y) #define DO_PROFILE_ADD(x,n) #define START_PROFILE(x) +#define START_PROFILE_NESTED(x) #define START_PROFILE_BYTES(x,n) #define END_PROFILE(x) +#define END_PROFILE_NESTED(x) #endif #endif |