diff probes.h @ 61:984f7d78bfdf

Merge See what happens -- merged test stuff into Nov 8 VMS version
author SeanHalle
date Thu, 11 Nov 2010 06:19:51 -0800
parents f59cfa31a579
children a6c442d52590 13b22ffb8a2f
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/probes.h	Thu Nov 11 06:19:51 2010 -0800
     1.3 @@ -0,0 +1,194 @@
     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 +
    1.21 +   //when STATS__TURN_ON_PROBES is defined allows using probes to measure
    1.22 +   // time intervals.  The probes are macros that only compile to something
    1.23 +   // when STATS__TURN_ON_PROBES is defined.  The probes are saved in the
    1.24 +   // master env -- but only when this is defined.
    1.25 +   //The TSC probes use RDTSC instr, can be unreliable, Dbl uses gettimeofday
    1.26 +#define STATS__TURN_ON_PROBES
    1.27 +//#define STATS__USE_TSC_PROBES
    1.28 +#define STATS__USE_DBL_PROBES
    1.29 +
    1.30 +//typedef struct _IntervalProbe IntervalProbe; //in VMS.h
    1.31 +
    1.32 +struct _IntervalProbe
    1.33 + {
    1.34 +   char           *nameStr;
    1.35 +   int32           probeID;
    1.36 +
    1.37 +   int32           schedChoiceWasRecorded;
    1.38 +   int32           coreNum;
    1.39 +   int32           procrID;
    1.40 +   float64         procrCreateSecs;
    1.41 +
    1.42 +   #ifdef STATS__USE_TSC_PROBES
    1.43 +   TSCount    startStamp;
    1.44 +   TSCount    endStamp;
    1.45 +   #else
    1.46 +   struct timeval  startStamp;
    1.47 +   struct timeval  endStamp;
    1.48 +   #endif
    1.49 +   float64         startSecs;
    1.50 +   float64         endSecs;
    1.51 +   float64         interval;
    1.52 +   DblHist        *hist;//if NULL, then is single interval probe
    1.53 + };
    1.54 +
    1.55 +
    1.56 +//============================= Statistics ==================================
    1.57 +
    1.58 +   //Frequency of TS counts
    1.59 +   //TODO: change freq for each machine
    1.60 +#define TSCOUNT_FREQ 3180000000
    1.61 +
    1.62 +inline TSCount getTSCount();
    1.63 +
    1.64 +
    1.65 +//======================== Probes =============================
    1.66 +//
    1.67 +// Use macros to allow turning probes off with a #define switch
    1.68 +#ifdef STATS__ENABLE_PROBES
    1.69 +int32
    1.70 +VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr);
    1.71 +#define VMS__record_time_point_into_new_probe( nameStr, animPr ) \
    1.72 +        VMS_impl__record_time_point_in_new_probe( nameStr, animPr )
    1.73 +
    1.74 +int32
    1.75 +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr );
    1.76 +#define VMS_ext__record_time_point_into_new_probe( nameStr ) \
    1.77 +        VMS_ext_impl__record_time_point_into_new_probe( nameStr )
    1.78 +
    1.79 +
    1.80 +int32
    1.81 +VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr );
    1.82 +#define VMS__create_single_interval_probe( nameStr, animPr ) \
    1.83 +        VMS_impl__create_single_interval_probe( nameStr, animPr )
    1.84 +
    1.85 +
    1.86 +int32
    1.87 +VMS_impl__create_histogram_probe( int32   numBins, float64    startValue,
    1.88 +               float64 binWidth, char    *nameStr, VirtProcr *animPr );
    1.89 +#define VMS__create_histogram_probe(      numBins, startValue,              \
    1.90 +                                          binWidth, nameStr, animPr )       \
    1.91 +        VMS_impl__create_histogram_probe( numBins, startValue,              \
    1.92 +                                          binWidth, nameStr, animPr )
    1.93 +void
    1.94 +VMS_impl__free_probe( IntervalProbe *probe );
    1.95 +#define VMS__free_probe( probe ) \
    1.96 +        VMS_impl__free_probe( probe )
    1.97 +
    1.98 +void
    1.99 +VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr );
   1.100 +#define VMS__index_probe_by_its_name( probeID, animPr ) \
   1.101 +        VMS_impl__index_probe_by_its_name( probeID, animPr )
   1.102 +
   1.103 +IntervalProbe *
   1.104 +VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr );
   1.105 +#define VMS__get_probe_by_name( probeID, animPr ) \
   1.106 +        VMS_impl__get_probe_by_name( probeName, animPr )
   1.107 +
   1.108 +void
   1.109 +VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr );
   1.110 +#define VMS__record_sched_choice_into_probe( probeID, animPr ) \
   1.111 +        VMS_impl__record_sched_choice_into_probe( probeID, animPr )
   1.112 +
   1.113 +void
   1.114 +VMS_impl__record_interval_start_in_probe( int32 probeID );
   1.115 +#define VMS__record_interval_start_in_probe( probeID ) \
   1.116 +        VMS_impl__record_interval_start_in_probe( probeID )
   1.117 +
   1.118 +void
   1.119 +VMS_impl__record_interval_end_in_probe( int32 probeID );
   1.120 +#define VMS__record_interval_end_in_probe( probeID ) \
   1.121 +        VMS_impl__record_interval_end_in_probe( probeID )
   1.122 +
   1.123 +void
   1.124 +VMS_impl__print_stats_of_probe( int32 probeID );
   1.125 +#define VMS__print_stats_of_probe( probeID ) \
   1.126 +        VMS_impl__print_stats_of_probe( probeID )
   1.127 +
   1.128 +void
   1.129 +VMS_impl__print_stats_of_all_probes();
   1.130 +#define VMS__print_stats_of_all_probes \
   1.131 +        VMS_impl__print_stats_of_all_probes
   1.132 +
   1.133 +
   1.134 +#else
   1.135 +int32
   1.136 +VMS_impl__record_time_point_into_new_probe( char *nameStr,VirtProcr *animPr);
   1.137 +#define VMS__record_time_point_into_new_probe( nameStr, animPr ) \
   1.138 +       0 /* do nothing */
   1.139 +
   1.140 +int32
   1.141 +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr);
   1.142 +#define VMS_ext__record_time_point_into_new_probe( nameStr ) \
   1.143 +       0 /* do nothing */
   1.144 +
   1.145 +
   1.146 +int32
   1.147 +VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr );
   1.148 +#define VMS__create_single_interval_probe( nameStr, animPr ) \
   1.149 +       0 /* do nothing */
   1.150 +
   1.151 +
   1.152 +int32
   1.153 +VMS_impl__create_histogram_probe( int32   numBins, float64    startValue,
   1.154 +               float64 binWidth, char    *nameStr, VirtProcr *animPr );
   1.155 +#define VMS__create_histogram_probe(      numBins, startValue,              \
   1.156 +                                          binWidth, nameStr, animPr )       \
   1.157 +       0 /* do nothing */
   1.158 +
   1.159 +void
   1.160 +VMS_impl__index_probe_by_its_name( int32 probeID, VirtProcr *animPr );
   1.161 +#define VMS__index_probe_by_its_name( probeID, animPr ) \
   1.162 +        /* do nothing */
   1.163 +
   1.164 +IntervalProbe *
   1.165 +VMS_impl__get_probe_by_name( char *probeName, VirtProcr *animPr );
   1.166 +#define VMS__get_probe_by_name( probeID, animPr ) \
   1.167 +       NULL /* do nothing */
   1.168 +
   1.169 +void
   1.170 +VMS_impl__record_sched_choice_into_probe( int32 probeID, VirtProcr *animPr );
   1.171 +#define VMS__record_sched_choice_into_probe( probeID, animPr ) \
   1.172 +        /* do nothing */
   1.173 +
   1.174 +void
   1.175 +VMS_impl__record_interval_start_in_probe( int32 probeID );
   1.176 +#define VMS__record_interval_start_in_probe( probeID ) \
   1.177 +        /* do nothing */
   1.178 +
   1.179 +void
   1.180 +VMS_impl__record_interval_end_in_probe( int32 probeID );
   1.181 +#define VMS__record_interval_end_in_probe( probeID ) \
   1.182 +        /* do nothing */
   1.183 +
   1.184 +void
   1.185 +VMS_impl__print_stats_of_probe( int32 probeID );
   1.186 +#define VMS__print_stats_of_probe( probeID ) \
   1.187 +        /* do nothing */
   1.188 +
   1.189 +void
   1.190 +VMS_impl__print_stats_of_all_probes();
   1.191 +#define VMS__print_stats_of_all_probes \
   1.192 +        /* do nothing */
   1.193 +
   1.194 +#endif   /* defined STATS__ENABLE_PROBES */
   1.195 +
   1.196 +#endif	/* _PROBES_H */
   1.197 +