annotate probes.h @ 51:2952d337d6f3

Just changed name of design notes
author Me
date Sat, 30 Oct 2010 20:55:39 -0700
parents
children f59cfa31a579
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
Me@50 11 #define __USE_GNU
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 //turns on the probe-instrumentation in the application -- when not
Me@50 18 // defined, the calls to the probe functions turn into comments
Me@50 19 //#define STATS__ENABLE_PROBES
Me@50 20
Me@50 21 //when STATS__TURN_ON_PROBES is defined allows using probes to measure
Me@50 22 // time intervals. The probes are macros that only compile to something
Me@50 23 // when STATS__TURN_ON_PROBES is defined. The probes are saved in the
Me@50 24 // master env -- but only when this is defined.
Me@50 25 //The TSC probes use RDTSC instr, can be unreliable, Dbl uses gettimeofday
Me@50 26 #define STATS__TURN_ON_PROBES
Me@50 27 //#define STATS__USE_TSC_PROBES
Me@50 28 #define STATS__USE_DBL_PROBES
Me@50 29
Me@50 30 //typedef struct _IntervalProbe IntervalProbe; //in VMS.h
Me@50 31
Me@50 32 struct _IntervalProbe
Me@50 33 {
Me@50 34 char *nameStr;
Me@50 35 int32 probeID;
Me@50 36
Me@50 37 int32 schedChoiceWasRecorded;
Me@50 38 int32 coreNum;
Me@50 39 int32 procrID;
Me@50 40 float64 procrCreateSecs;
Me@50 41
Me@50 42 #ifdef STATS__USE_TSC_PROBES
Me@50 43 TSCount startStamp;
Me@50 44 TSCount endStamp;
Me@50 45 #else
Me@50 46 struct timeval startStamp;
Me@50 47 struct timeval endStamp;
Me@50 48 #endif
Me@50 49 float64 startSecs;
Me@50 50 float64 endSecs;
Me@50 51 float64 interval;
Me@50 52 DblHist *hist;//if NULL, then is single interval probe
Me@50 53 };
Me@50 54
Me@50 55
Me@50 56 //============================= Statistics ==================================
Me@50 57
Me@50 58 //Frequency of TS counts
Me@50 59 //TODO: change freq for each machine
Me@50 60 #define TSCOUNT_FREQ 3180000000
Me@50 61
Me@50 62 inline TSCount getTSCount();
Me@50 63
Me@50 64
Me@50 65 //======================== Probes =============================
Me@50 66 //
Me@50 67 // Use macros to allow turning probes off with a #define switch
Me@50 68 #ifdef STATS__ENABLE_PROBES
Me@50 69 int32
Me@50 70 VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr);
Me@50 71 #define VMS__record_time_point_into_new_probe( nameStr, animPr ) \
Me@50 72 VMS_impl__record_time_point_in_new_probe( nameStr, animPr )
Me@50 73
Me@50 74 int32
Me@50 75 VMS_ext_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr);
Me@50 76 #define VMS_ext__record_time_point_into_new_probe( nameStr ) \
Me@50 77 VMS_ext_impl__record_time_point_into_new_probe_impl( nameStr )
Me@50 78
Me@50 79
Me@50 80 int32
Me@50 81 VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr );
Me@50 82 #define VMS__create_single_interval_probe( nameStr, animPr ) \
Me@50 83 VMS_impl__create_single_interval_probe( nameStr, animPr )
Me@50 84
Me@50 85
Me@50 86 int32
Me@50 87 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue,
Me@50 88 float64 binWidth, char *nameStr, VirtProcr *animPr );
Me@50 89 #define VMS__create_histogram_probe( numBins, startValue, \
Me@50 90 binWidth, nameStr, animPr ) \
Me@50 91 VMS_impl__create_histogram_probe( numBins, startValue, \
Me@50 92 binWidth, nameStr, animPr )
Me@50 93
Me@50 94 void
Me@50 95 VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr );
Me@50 96 #define VMS__index_probe_by_its_name( probeID, animPr ) \
Me@50 97 VMS_impl__index_probe_by_its_name( probeID, animPr )
Me@50 98
Me@50 99 IntervalProbe *
Me@50 100 VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr );
Me@50 101 #define VMS__get_probe_by_name( probeID, animPr ) \
Me@50 102 VMS_impl__get_probe_by_name( probeName, animPr )
Me@50 103
Me@50 104 void
Me@50 105 VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr );
Me@50 106 #define VMS__record_sched_choice_into_probe( probeID, animPr ) \
Me@50 107 VMS_impl__record_sched_choice_into_probe( probeID, animPr )
Me@50 108
Me@50 109 void
Me@50 110 VMS_impl__record_interval_start_in_probe( int32 probeID );
Me@50 111 #define VMS__record_interval_start_in_probe( probeID ) \
Me@50 112 VMS_impl__record_interval_start_in_probe( probeID )
Me@50 113
Me@50 114 void
Me@50 115 VMS_impl__record_interval_end_in_probe( int32 probeID );
Me@50 116 #define VMS__record_interval_end_in_probe( probeID ) \
Me@50 117 VMS_impl__record_interval_end_in_probe( probeID )
Me@50 118
Me@50 119 void
Me@50 120 VMS_impl__print_stats_of_probe( int32 probeID );
Me@50 121 #define VMS__print_stats_of_probe( probeID ) \
Me@50 122 VMS_impl__print_stats_of_probe( probeID )
Me@50 123
Me@50 124 void
Me@50 125 VMS_impl__print_stats_of_all_probes();
Me@50 126 #define VMS__print_stats_of_all_probes \
Me@50 127 VMS_impl__print_stats_of_all_probes
Me@50 128
Me@50 129
Me@50 130 #else
Me@50 131 int32
Me@50 132 VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr);
Me@50 133 #define VMS__record_time_point_into_new_probe( nameStr, animPr ) \
Me@50 134 0 /* do nothing */
Me@50 135
Me@50 136 int32
Me@50 137 VMS_ext_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr);
Me@50 138 #define VMS_ext__record_time_point_into_new_probe( nameStr ) \
Me@50 139 0 /* do nothing */
Me@50 140
Me@50 141
Me@50 142 int32
Me@50 143 VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr );
Me@50 144 #define VMS__create_single_interval_probe( nameStr, animPr ) \
Me@50 145 0 /* do nothing */
Me@50 146
Me@50 147
Me@50 148 int32
Me@50 149 VMS_impl__create_histogram_probe( int32 numBins, float64 startValue,
Me@50 150 float64 binWidth, char *nameStr, VirtProcr *animPr );
Me@50 151 #define VMS__create_histogram_probe( numBins, startValue, \
Me@50 152 binWidth, nameStr, animPr ) \
Me@50 153 0 /* do nothing */
Me@50 154
Me@50 155 void
Me@50 156 VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr );
Me@50 157 #define VMS__index_probe_by_its_name( probeID, animPr ) \
Me@50 158 /* do nothing */
Me@50 159
Me@50 160 IntervalProbe *
Me@50 161 VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr );
Me@50 162 #define VMS__get_probe_by_name( probeID, animPr ) \
Me@50 163 NULL /* do nothing */
Me@50 164
Me@50 165 void
Me@50 166 VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr );
Me@50 167 #define VMS__record_sched_choice_into_probe( probeID, animPr ) \
Me@50 168 /* do nothing */
Me@50 169
Me@50 170 void
Me@50 171 VMS_impl__record_interval_start_in_probe( int32 probeID );
Me@50 172 #define VMS__record_interval_start_in_probe( probeID ) \
Me@50 173 /* do nothing */
Me@50 174
Me@50 175 void
Me@50 176 VMS_impl__record_interval_end_in_probe( int32 probeID );
Me@50 177 #define VMS__record_interval_end_in_probe( probeID ) \
Me@50 178 /* do nothing */
Me@50 179
Me@50 180 void
Me@50 181 VMS_impl__print_stats_of_probe( int32 probeID );
Me@50 182 #define VMS__print_stats_of_probe( probeID ) \
Me@50 183 /* do nothing */
Me@50 184
Me@50 185 void
Me@50 186 VMS_impl__print_stats_of_all_probes();
Me@50 187 #define VMS__print_stats_of_all_probes \
Me@50 188 /* do nothing */
Me@50 189
Me@50 190 #endif /* defined STATS__ENABLE_PROBES */
Me@50 191
Me@50 192 #endif /* _PROBES_H */
Me@50 193