Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff probes.h @ 50:8f7141a9272e
Added VMS__malloc and probes, and major re-factoring to separate mallocs
| author | Me |
|---|---|
| date | Sat, 30 Oct 2010 20:54:36 -0700 |
| parents | |
| children | f59cfa31a579 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/probes.h Sat Oct 30 20:54:36 2010 -0700 1.3 @@ -0,0 +1,193 @@ 1.4 +/* 1.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + * 1.8 + * Author: seanhalle@yahoo.com 1.9 + * 1.10 + */ 1.11 + 1.12 +#ifndef _PROBES_H 1.13 +#define _PROBES_H 1.14 +#define __USE_GNU 1.15 + 1.16 +#include "VMS_primitive_data_types.h" 1.17 + 1.18 +#include <sys/time.h> 1.19 + 1.20 + //turns on the probe-instrumentation in the application -- when not 1.21 + // defined, the calls to the probe functions turn into comments 1.22 +//#define STATS__ENABLE_PROBES 1.23 + 1.24 + //when STATS__TURN_ON_PROBES is defined allows using probes to measure 1.25 + // time intervals. The probes are macros that only compile to something 1.26 + // when STATS__TURN_ON_PROBES is defined. The probes are saved in the 1.27 + // master env -- but only when this is defined. 1.28 + //The TSC probes use RDTSC instr, can be unreliable, Dbl uses gettimeofday 1.29 +#define STATS__TURN_ON_PROBES 1.30 +//#define STATS__USE_TSC_PROBES 1.31 +#define STATS__USE_DBL_PROBES 1.32 + 1.33 +//typedef struct _IntervalProbe IntervalProbe; //in VMS.h 1.34 + 1.35 +struct _IntervalProbe 1.36 + { 1.37 + char *nameStr; 1.38 + int32 probeID; 1.39 + 1.40 + int32 schedChoiceWasRecorded; 1.41 + int32 coreNum; 1.42 + int32 procrID; 1.43 + float64 procrCreateSecs; 1.44 + 1.45 + #ifdef STATS__USE_TSC_PROBES 1.46 + TSCount startStamp; 1.47 + TSCount endStamp; 1.48 + #else 1.49 + struct timeval startStamp; 1.50 + struct timeval endStamp; 1.51 + #endif 1.52 + float64 startSecs; 1.53 + float64 endSecs; 1.54 + float64 interval; 1.55 + DblHist *hist;//if NULL, then is single interval probe 1.56 + }; 1.57 + 1.58 + 1.59 +//============================= Statistics ================================== 1.60 + 1.61 + //Frequency of TS counts 1.62 + //TODO: change freq for each machine 1.63 +#define TSCOUNT_FREQ 3180000000 1.64 + 1.65 +inline TSCount getTSCount(); 1.66 + 1.67 + 1.68 +//======================== Probes ============================= 1.69 +// 1.70 +// Use macros to allow turning probes off with a #define switch 1.71 +#ifdef STATS__ENABLE_PROBES 1.72 +int32 1.73 +VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr); 1.74 +#define VMS__record_time_point_into_new_probe( nameStr, animPr ) \ 1.75 + VMS_impl__record_time_point_in_new_probe( nameStr, animPr ) 1.76 + 1.77 +int32 1.78 +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr); 1.79 +#define VMS_ext__record_time_point_into_new_probe( nameStr ) \ 1.80 + VMS_ext_impl__record_time_point_into_new_probe_impl( nameStr ) 1.81 + 1.82 + 1.83 +int32 1.84 +VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr ); 1.85 +#define VMS__create_single_interval_probe( nameStr, animPr ) \ 1.86 + VMS_impl__create_single_interval_probe( nameStr, animPr ) 1.87 + 1.88 + 1.89 +int32 1.90 +VMS_impl__create_histogram_probe( int32 numBins, float64 startValue, 1.91 + float64 binWidth, char *nameStr, VirtProcr *animPr ); 1.92 +#define VMS__create_histogram_probe( numBins, startValue, \ 1.93 + binWidth, nameStr, animPr ) \ 1.94 + VMS_impl__create_histogram_probe( numBins, startValue, \ 1.95 + binWidth, nameStr, animPr ) 1.96 + 1.97 +void 1.98 +VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr ); 1.99 +#define VMS__index_probe_by_its_name( probeID, animPr ) \ 1.100 + VMS_impl__index_probe_by_its_name( probeID, animPr ) 1.101 + 1.102 +IntervalProbe * 1.103 +VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr ); 1.104 +#define VMS__get_probe_by_name( probeID, animPr ) \ 1.105 + VMS_impl__get_probe_by_name( probeName, animPr ) 1.106 + 1.107 +void 1.108 +VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr ); 1.109 +#define VMS__record_sched_choice_into_probe( probeID, animPr ) \ 1.110 + VMS_impl__record_sched_choice_into_probe( probeID, animPr ) 1.111 + 1.112 +void 1.113 +VMS_impl__record_interval_start_in_probe( int32 probeID ); 1.114 +#define VMS__record_interval_start_in_probe( probeID ) \ 1.115 + VMS_impl__record_interval_start_in_probe( probeID ) 1.116 + 1.117 +void 1.118 +VMS_impl__record_interval_end_in_probe( int32 probeID ); 1.119 +#define VMS__record_interval_end_in_probe( probeID ) \ 1.120 + VMS_impl__record_interval_end_in_probe( probeID ) 1.121 + 1.122 +void 1.123 +VMS_impl__print_stats_of_probe( int32 probeID ); 1.124 +#define VMS__print_stats_of_probe( probeID ) \ 1.125 + VMS_impl__print_stats_of_probe( probeID ) 1.126 + 1.127 +void 1.128 +VMS_impl__print_stats_of_all_probes(); 1.129 +#define VMS__print_stats_of_all_probes \ 1.130 + VMS_impl__print_stats_of_all_probes 1.131 + 1.132 + 1.133 +#else 1.134 +int32 1.135 +VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr); 1.136 +#define VMS__record_time_point_into_new_probe( nameStr, animPr ) \ 1.137 + 0 /* do nothing */ 1.138 + 1.139 +int32 1.140 +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr); 1.141 +#define VMS_ext__record_time_point_into_new_probe( nameStr ) \ 1.142 + 0 /* do nothing */ 1.143 + 1.144 + 1.145 +int32 1.146 +VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr ); 1.147 +#define VMS__create_single_interval_probe( nameStr, animPr ) \ 1.148 + 0 /* do nothing */ 1.149 + 1.150 + 1.151 +int32 1.152 +VMS_impl__create_histogram_probe( int32 numBins, float64 startValue, 1.153 + float64 binWidth, char *nameStr, VirtProcr *animPr ); 1.154 +#define VMS__create_histogram_probe( numBins, startValue, \ 1.155 + binWidth, nameStr, animPr ) \ 1.156 + 0 /* do nothing */ 1.157 + 1.158 +void 1.159 +VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr ); 1.160 +#define VMS__index_probe_by_its_name( probeID, animPr ) \ 1.161 + /* do nothing */ 1.162 + 1.163 +IntervalProbe * 1.164 +VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr ); 1.165 +#define VMS__get_probe_by_name( probeID, animPr ) \ 1.166 + NULL /* do nothing */ 1.167 + 1.168 +void 1.169 +VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr ); 1.170 +#define VMS__record_sched_choice_into_probe( probeID, animPr ) \ 1.171 + /* do nothing */ 1.172 + 1.173 +void 1.174 +VMS_impl__record_interval_start_in_probe( int32 probeID ); 1.175 +#define VMS__record_interval_start_in_probe( probeID ) \ 1.176 + /* do nothing */ 1.177 + 1.178 +void 1.179 +VMS_impl__record_interval_end_in_probe( int32 probeID ); 1.180 +#define VMS__record_interval_end_in_probe( probeID ) \ 1.181 + /* do nothing */ 1.182 + 1.183 +void 1.184 +VMS_impl__print_stats_of_probe( int32 probeID ); 1.185 +#define VMS__print_stats_of_probe( probeID ) \ 1.186 + /* do nothing */ 1.187 + 1.188 +void 1.189 +VMS_impl__print_stats_of_all_probes(); 1.190 +#define VMS__print_stats_of_all_probes \ 1.191 + /* do nothing */ 1.192 + 1.193 +#endif /* defined STATS__ENABLE_PROBES */ 1.194 + 1.195 +#endif /* _PROBES_H */ 1.196 +
