view probes.h @ 135:0b49fd35afc1

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