HPCToolkit
hpcrun_stats.c
Go to the documentation of this file.
1 // -*-Mode: C++;-*- // technically C99
2 
3 // * BeginRiceCopyright *****************************************************
4 //
5 // $HeadURL$
6 // $Id$
7 //
8 // --------------------------------------------------------------------------
9 // Part of HPCToolkit (hpctoolkit.org)
10 //
11 // Information about sources of support for research and development of
12 // HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
13 // --------------------------------------------------------------------------
14 //
15 // Copyright ((c)) 2002-2019, Rice University
16 // All rights reserved.
17 //
18 // Redistribution and use in source and binary forms, with or without
19 // modification, are permitted provided that the following conditions are
20 // met:
21 //
22 // * Redistributions of source code must retain the above copyright
23 // notice, this list of conditions and the following disclaimer.
24 //
25 // * Redistributions in binary form must reproduce the above copyright
26 // notice, this list of conditions and the following disclaimer in the
27 // documentation and/or other materials provided with the distribution.
28 //
29 // * Neither the name of Rice University (RICE) nor the names of its
30 // contributors may be used to endorse or promote products derived from
31 // this software without specific prior written permission.
32 //
33 // This software is provided by RICE and contributors "as is" and any
34 // express or implied warranties, including, but not limited to, the
35 // implied warranties of merchantability and fitness for a particular
36 // purpose are disclaimed. In no event shall RICE or contributors be
37 // liable for any direct, indirect, incidental, special, exemplary, or
38 // consequential damages (including, but not limited to, procurement of
39 // substitute goods or services; loss of use, data, or profits; or
40 // business interruption) however caused and on any theory of liability,
41 // whether in contract, strict liability, or tort (including negligence
42 // or otherwise) arising in any way out of the use of this software, even
43 // if advised of the possibility of such damage.
44 //
45 // ******************************************************* EndRiceCopyright *
46 
47 
48 //***************************************************************************
49 // local include files
50 //***************************************************************************
51 #include "sample_event.h"
52 #include "disabled.h"
53 
54 #include <memory/hpcrun-malloc.h>
55 #include <messages/messages.h>
56 
60 
61 
62 //***************************************************************************
63 // local variables
64 //***************************************************************************
65 
66 static atomic_long num_samples_total = ATOMIC_VAR_INIT(0);
67 static atomic_long num_samples_attempted = ATOMIC_VAR_INIT(0);
70 static atomic_long num_samples_dropped = ATOMIC_VAR_INIT(0);
71 static atomic_long num_samples_segv = ATOMIC_VAR_INIT(0);
72 static atomic_long num_samples_partial = ATOMIC_VAR_INIT(0);
73 static atomic_long num_samples_yielded = ATOMIC_VAR_INIT(0);
74 
77 
78 static atomic_long trolled = ATOMIC_VAR_INIT(0);
79 static atomic_long frames_total = ATOMIC_VAR_INIT(0);
80 static atomic_long trolled_frames = ATOMIC_VAR_INIT(0);
81 
82 //***************************************************************************
83 // interface operations
84 //***************************************************************************
85 
86 void
88 {
100 }
101 
102 
103 //-----------------------------
104 // samples total
105 //-----------------------------
106 
107 void
109 {
111 }
112 
113 
114 long
116 {
118 }
119 
120 
121 
122 //-----------------------------
123 // samples attempted
124 //-----------------------------
125 
126 void
128 {
130 }
131 
132 
133 long
135 {
137 }
138 
139 
140 
141 //-----------------------------
142 // samples blocked async
143 //-----------------------------
144 
145 // The async blocks happen in the signal handlers, without getting to
146 // hpcrun_sample_callpath, so also increment the total count here.
147 void
149 {
152 }
153 
154 
155 long
157 {
159 }
160 
161 
162 
163 //-----------------------------
164 // samples blocked dlopen
165 //-----------------------------
166 
167 void
169 {
171 }
172 
173 
174 long
176 {
178 }
179 
180 
181 
182 //-----------------------------
183 // samples dropped
184 //-----------------------------
185 
186 void
188 {
190 }
191 
192 long
194 {
196 }
197 
198 //----------------------------
199 // partial unwinds
200 //----------------------------
201 
202 void
204 {
206 }
207 
208 long
210 {
212 }
213 
214 //-----------------------------
215 // samples segv
216 //-----------------------------
217 
218 void
220 {
222 }
223 
224 
225 long
227 {
229 }
230 
231 
232 
233 
234 //-----------------------------
235 // unwind intervals total
236 //-----------------------------
237 
238 void
240 {
242 }
243 
244 
245 long
247 {
249 }
250 
251 
252 
253 //-----------------------------
254 // unwind intervals suspicious
255 //-----------------------------
256 
257 void
259 {
261 }
262 
263 
264 long
266 {
268 }
269 
270 //------------------------------------------------------
271 // samples that include 1 or more successful troll steps
272 //------------------------------------------------------
273 
274 void
276 {
278 }
279 
280 long
282 {
284 }
285 
286 //------------------------------------------------------
287 // total number of (unwind) frames in sample set
288 //------------------------------------------------------
289 
290 void
292 {
294 }
295 
296 long
298 {
300 }
301 
302 //---------------------------------------------------------------------
303 // total number of (unwind) frames in sample set that employed trolling
304 //---------------------------------------------------------------------
305 
306 void
308 {
310 }
311 
312 long
314 {
316 }
317 
318 //----------------------------
319 // samples yielded due to deadlock prevention
320 //----------------------------
321 
322 void
324 {
326 }
327 
328 long
330 {
332 }
333 
334 //-----------------------------
335 // print summary
336 //-----------------------------
337 
338 void
340 {
347  if (ENABLED(NO_PARTIAL_UNW)) {
349  }
350 
352 
353  AMSG("SAMPLE ANOMALIES: blocks: %ld (async: %ld, dlopen: %ld), "
354  "errors: %ld (segv: %ld, soft: %ld)",
356  errant, num_samples_segv, soft);
357 
358  AMSG("SUMMARY: samples: %ld (recorded: %ld, blocked: %ld, errant: %ld, trolled: %ld, yielded: %ld),\n"
359  " frames: %ld (trolled: %ld)\n"
360  " intervals: %ld (suspicious: %ld)",
361  num_samples_total, valid, blocked, errant, trolled, num_samples_yielded,
364 
365  if (hpcrun_get_disabled()) {
366  AMSG("SAMPLING HAS BEEN DISABLED");
367  }
368 
369  // logs, retentions || adj.: recorded, retained, written
370 
371  if (ENABLED(UNW_VALID)) {
373  }
374 }
375 
static atomic_long frames_total
Definition: hpcrun_stats.c:79
static atomic_long trolled_frames
Definition: hpcrun_stats.c:80
void hpcrun_stats_num_samples_dropped_inc(void)
Definition: hpcrun_stats.c:187
void hpcrun_stats_num_samples_blocked_dlopen_inc(void)
Definition: hpcrun_stats.c:168
long hpcrun_stats_frames_total(void)
Definition: hpcrun_stats.c:297
void hpcrun_stats_num_samples_total_inc(void)
Definition: hpcrun_stats.c:108
void hpcrun_stats_num_samples_attempted_inc(void)
Definition: hpcrun_stats.c:127
void hpcrun_stats_frames_total_inc(long amt)
Definition: hpcrun_stats.c:291
void hpcrun_stats_num_samples_partial_inc(void)
Definition: hpcrun_stats.c:203
void hpcrun_stats_num_samples_yielded_inc(void)
Definition: hpcrun_stats.c:323
#define atomic_fetch_add_explicit(object, operand, order)
Definition: stdatomic.h:366
#define ATOMIC_VAR_INIT(value)
Definition: stdatomic.h:132
static atomic_long num_samples_segv
Definition: hpcrun_stats.c:71
long hpcrun_stats_num_samples_segv(void)
Definition: hpcrun_stats.c:226
void hpcrun_stats_reinit(void)
Definition: hpcrun_stats.c:87
long hpcrun_stats_num_samples_total(void)
Definition: hpcrun_stats.c:115
long hpcrun_stats_num_unwind_intervals_suspicious(void)
Definition: hpcrun_stats.c:265
void hpcrun_stats_num_samples_segv_inc(void)
Definition: hpcrun_stats.c:219
#define atomic_load_explicit(object, order)
Definition: stdatomic.h:378
#define atomic_store_explicit(object, desired, order)
Definition: stdatomic.h:380
long hpcrun_stats_num_samples_attempted(void)
Definition: hpcrun_stats.c:134
static atomic_long num_samples_attempted
Definition: hpcrun_stats.c:67
long hpcrun_stats_num_samples_dropped(void)
Definition: hpcrun_stats.c:193
void hpcrun_stats_num_samples_blocked_async_inc(void)
Definition: hpcrun_stats.c:148
void hpcrun_stats_print_summary(void)
Definition: hpcrun_stats.c:339
long hpcrun_stats_num_samples_yielded(void)
Definition: hpcrun_stats.c:329
void hpcrun_stats_num_unwind_intervals_total_inc(void)
Definition: hpcrun_stats.c:239
void hpcrun_memory_summary(void)
Definition: mem.c:387
static atomic_long num_samples_blocked_async
Definition: hpcrun_stats.c:68
long hpcrun_stats_num_samples_blocked_async(void)
Definition: hpcrun_stats.c:156
long hpcrun_stats_trolled_frames(void)
Definition: hpcrun_stats.c:313
void hpcrun_stats_trolled_inc(void)
Definition: hpcrun_stats.c:275
void hpcrun_validation_summary(void)
static atomic_long num_samples_partial
Definition: hpcrun_stats.c:72
static atomic_long num_unwind_intervals_total
Definition: hpcrun_stats.c:75
long hpcrun_stats_num_samples_partial(void)
Definition: hpcrun_stats.c:209
long hpcrun_stats_num_samples_blocked_dlopen(void)
Definition: hpcrun_stats.c:175
static atomic_long trolled
Definition: hpcrun_stats.c:78
static atomic_long num_samples_yielded
Definition: hpcrun_stats.c:73
void hpcrun_stats_trolled_frames_inc(long amt)
Definition: hpcrun_stats.c:307
#define AMSG
Definition: messages.h:71
static atomic_long num_samples_dropped
Definition: hpcrun_stats.c:70
static atomic_long num_samples_blocked_dlopen
Definition: hpcrun_stats.c:69
bool hpcrun_get_disabled(void)
Definition: disabled.c:80
long hpcrun_stats_trolled(void)
Definition: hpcrun_stats.c:281
void hpcrun_stats_num_unwind_intervals_suspicious_inc(void)
Definition: hpcrun_stats.c:258
static atomic_long num_samples_total
Definition: hpcrun_stats.c:66
long hpcrun_stats_num_unwind_intervals_total(void)
Definition: hpcrun_stats.c:246
static atomic_long num_unwind_intervals_suspicious
Definition: hpcrun_stats.c:76
#define ENABLED(f)
Definition: debug-flag.h:76