annotate probes.h @ 157:8cc3d3812c8a

smaller Hists for malloc, free and plugin
author Merten Sach <msach@mailbox.tu-berlin.de>
date Thu, 06 Oct 2011 15:58:34 +0200
parents 9ddbb071142d
children c11b9dcf6d24 0320b49ca013
rev   line source
Me@50 1 /*
Me@50 2 * Copyright 2009 OpenSourceStewardshipFoundation.org
Me@50 3 * Licensed under GNU General Public License version 2
Me@50 4 *
Me@50 5 * Author: seanhalle@yahoo.com
Me@50 6 *
Me@50 7 */
Me@50 8
Me@50 9 #ifndef _PROBES_H
Me@50 10 #define _PROBES_H
msach@76 11 #define _GNU_SOURCE
Me@50 12
Me@50 13 #include "VMS_primitive_data_types.h"
Me@50 14
Me@50 15 #include <sys/time.h>
Me@50 16
Me@50 17
Me@50 18 //when STATS__TURN_ON_PROBES is defined allows using probes to measure
Me@50 19 // time intervals. The probes are macros that only compile to something
Me@50 20 // when STATS__TURN_ON_PROBES is defined. The probes are saved in the
Me@50 21 // master env -- but only when this is defined.
Me@50 22 //The TSC probes use RDTSC instr, can be unreliable, Dbl uses gettimeofday
Me@50 23 #define STATS__TURN_ON_PROBES
Me@50 24 //#define STATS__USE_TSC_PROBES
Me@50 25 #define STATS__USE_DBL_PROBES
Me@50 26
Me@50 27 //typedef struct _IntervalProbe IntervalProbe; //in VMS.h
Me@50 28
Me@50 29 struct _IntervalProbe
Me@50 30 {
Me@50 31 char *nameStr;
Me@50 32 int32 probeID;
Me@50 33
Me@50 34 int32 schedChoiceWasRecorded;
Me@50 35 int32 coreNum;
Me@50 36 int32 procrID;
Me@50 37 float64 procrCreateSecs;
Me@50 38
Me@50 39 #ifdef STATS__USE_TSC_PROBES
Me@50 40 TSCount startStamp;
Me@50 41 TSCount endStamp;
Me@50 42 #else
Me@50 43 struct timeval startStamp;
Me@50 44 struct timeval endStamp;
Me@50 45 #endif
Me@50 46 float64 startSecs;
Me@50 47 float64 endSecs;
Me@50 48 float64 interval;
Me@50 49 DblHist *hist;//if NULL, then is single interval probe
Me@50 50 };
Me@50 51
Me@50 52
Me@50 53 //============================= Statistics ==================================
Me@50 54
Me@50 55 //Frequency of TS counts
Me@50 56 //TODO: change freq for each machine
Me@50 57 #define TSCOUNT_FREQ 3180000000
Me@50 58
Me@50 59 inline TSCount getTSCount();
Me@50 60
Me@50 61
Me@50 62 //======================== Probes =============================
Me@50 63 //
Me@50 64 // Use macros to allow turning probes off with a #define switch
Me@50 65 #ifdef STATS__ENABLE_PROBES
Me@50 66 int32
Me@50 67 VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr);
Me@50 68 #define VMS__record_time_point_into_new_probe( nameStr, animPr ) \
Me@50 69 VMS_impl__record_time_point_in_new_probe( nameStr, animPr )
Me@50 70
Me@50 71 int32
Me@52 72 VMS_ext_impl__record_time_point_into_new_probe( char *nameStr );
Me@50 73 #define VMS_ext__record_time_point_into_new_probe( nameStr ) \
Me@52 74 VMS_ext_impl__record_time_point_into_new_probe( nameStr )
Me@50 75
Me@50 76
Me@50 77 int32
Me@50 78 VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr );
Me@50 79 #define VMS__create_single_interval_probe( nameStr, animPr ) \
Me@50 80 VMS_impl__create_single_interval_probe( nameStr, animPr )
Me@50 81
Me@50 82
Me@50 83 int32
Me@50 84 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue,
Me@50 85 float64 binWidth, char *nameStr, VirtProcr *animPr );
Me@50 86 #define VMS__create_histogram_probe( numBins, startValue, \
Me@50 87 binWidth, nameStr, animPr ) \
Me@50 88 VMS_impl__create_histogram_probe( numBins, startValue, \
Me@50 89 binWidth, nameStr, animPr )
Me@53 90 void
Me@53 91 VMS_impl__free_probe( IntervalProbe *probe );
Me@53 92 #define VMS__free_probe( probe ) \
Me@53 93 VMS_impl__free_probe( probe )
Me@50 94
Me@50 95 void
Me@50 96 VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr );
Me@50 97 #define VMS__index_probe_by_its_name( probeID, animPr ) \
Me@50 98 VMS_impl__index_probe_by_its_name( probeID, animPr )
Me@50 99
Me@50 100 IntervalProbe *
Me@50 101 VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr );
Me@50 102 #define VMS__get_probe_by_name( probeID, animPr ) \
Me@50 103 VMS_impl__get_probe_by_name( probeName, animPr )
Me@50 104
Me@50 105 void
Me@50 106 VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr );
Me@50 107 #define VMS__record_sched_choice_into_probe( probeID, animPr ) \
Me@50 108 VMS_impl__record_sched_choice_into_probe( probeID, animPr )
Me@50 109
Me@50 110 void
Me@50 111 VMS_impl__record_interval_start_in_probe( int32 probeID );
Me@50 112 #define VMS__record_interval_start_in_probe( probeID ) \
Me@50 113 VMS_impl__record_interval_start_in_probe( probeID )
Me@50 114
Me@50 115 void
Me@50 116 VMS_impl__record_interval_end_in_probe( int32 probeID );
Me@50 117 #define VMS__record_interval_end_in_probe( probeID ) \
Me@50 118 VMS_impl__record_interval_end_in_probe( probeID )
Me@50 119
Me@50 120 void
Me@50 121 VMS_impl__print_stats_of_probe( int32 probeID );
Me@50 122 #define VMS__print_stats_of_probe( probeID ) \
Me@50 123 VMS_impl__print_stats_of_probe( probeID )
Me@50 124
Me@50 125 void
Me@50 126 VMS_impl__print_stats_of_all_probes();
msach@78 127 #define VMS__print_stats_of_all_probes() \
msach@78 128 VMS_impl__print_stats_of_all_probes()
Me@50 129
Me@50 130
Me@50 131 #else
Me@50 132 int32
Me@50 133 VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr);
Me@50 134 #define VMS__record_time_point_into_new_probe( nameStr, animPr ) \
Me@50 135 0 /* do nothing */
Me@50 136
Me@50 137 int32
Me@65 138 VMS_ext_impl__record_time_point_into_new_probe( char *nameStr );
Me@50 139 #define VMS_ext__record_time_point_into_new_probe( nameStr ) \
Me@50 140 0 /* do nothing */
Me@50 141
Me@50 142
Me@50 143 int32
Me@50 144 VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr );
Me@50 145 #define VMS__create_single_interval_probe( nameStr, animPr ) \
Me@50 146 0 /* do nothing */
Me@50 147
Me@50 148
Me@50 149 int32
Me@50 150 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue,
Me@50 151 float64 binWidth, char *nameStr, VirtProcr *animPr );
Me@50 152 #define VMS__create_histogram_probe( numBins, startValue, \
Me@50 153 binWidth, nameStr, animPr ) \
Me@50 154 0 /* do nothing */
Me@50 155
Me@50 156 void
Me@50 157 VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr );
Me@50 158 #define VMS__index_probe_by_its_name( probeID, animPr ) \
Me@50 159 /* do nothing */
Me@50 160
Me@50 161 IntervalProbe *
Me@50 162 VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr );
Me@50 163 #define VMS__get_probe_by_name( probeID, animPr ) \
Me@50 164 NULL /* do nothing */
Me@50 165
Me@50 166 void
Me@50 167 VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr );
Me@50 168 #define VMS__record_sched_choice_into_probe( probeID, animPr ) \
Me@50 169 /* do nothing */
Me@50 170
Me@50 171 void
Me@50 172 VMS_impl__record_interval_start_in_probe( int32 probeID );
Me@50 173 #define VMS__record_interval_start_in_probe( probeID ) \
Me@50 174 /* do nothing */
Me@50 175
Me@50 176 void
Me@50 177 VMS_impl__record_interval_end_in_probe( int32 probeID );
Me@50 178 #define VMS__record_interval_end_in_probe( probeID ) \
Me@50 179 /* do nothing */
Me@50 180
Me@65 181 inline void doNothing();
Me@50 182 void
Me@50 183 VMS_impl__print_stats_of_probe( int32 probeID );
Me@50 184 #define VMS__print_stats_of_probe( probeID ) \
Me@65 185 doNothing/* do nothing */
Me@50 186
Me@50 187 void
Me@50 188 VMS_impl__print_stats_of_all_probes();
Me@50 189 #define VMS__print_stats_of_all_probes \
Me@65 190 doNothing/* do nothing */
Me@50 191
Me@50 192 #endif /* defined STATS__ENABLE_PROBES */
Me@50 193
Me@50 194 #endif /* _PROBES_H */
Me@50 195