annotate probes.h @ 178:c1784868dcea

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