HPCToolkit
cct_bundle.h
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 #ifndef CCT_BUNDLE_H
48 #define CCT_BUNDLE_H
49 #include <stdbool.h>
50 
51 #include "cct.h"
52 #include "cct_ctxt.h"
53 
54 #include <hpcrun/cct2metrics.h> // need to be placed after cct.h
55 
56 
57 //
58 // Data type not opaque : FIXME ??
59 //
60 
61 typedef struct cct_bundle_t {
62 
63  cct_node_t* top; // top level tree (at creation)
64 
65  cct_node_t* tree_root; // main cct for full unwinds from samples
66  // that terminate in main:
67  // 1) All unthreaded cases
68  // 2) All threaded cases where thread stack
69  // has been synthetically attached to main
70  // (as in some implementations of OpenMP)
71 
72  cct_node_t* thread_root; // root for full unwinds that terminate in 'pthread_create'
73 
74  cct_node_t* partial_unw_root; // adjunct tree for partial unwinds
75 
76  cct_node_t* special_idle_node; // node to signify "idle" resource (used by trace facility).
77 
78  cct_node_t* special_datacentric_node; // root for datacentric dynamic variables
79 
80  cct_node_t* special_no_thread_node; // trace node when outside the thread
81 
82  cct_ctxt_t* ctxt; // creation context for bundle
83 
84  unsigned long num_nodes; // utility to count nodes. NB: MIGHT go away
85 } cct_bundle_t;
86 
87 //
88 // Interface procedures
89 //
90 
91 extern void hpcrun_cct_bundle_init(cct_bundle_t* bundle, cct_ctxt_t* ctxt);
92 //
93 // IO for cct bundle
94 //
95 extern int hpcrun_cct_bundle_fwrite(FILE* fs, epoch_flags_t flags, cct_bundle_t* x,
96  cct2metrics_t* cct2metrics_map);
97 
98 //
99 // utility functions
100 //
101 extern bool hpcrun_empty_cct(cct_bundle_t* cct);
103 
104 cct_node_t*
106 
107 extern cct_node_t*
109 
110 #endif // CCT_BUNDLE_H
int hpcrun_cct_bundle_fwrite(FILE *fs, epoch_flags_t flags, cct_bundle_t *x, cct2metrics_t *cct2metrics_map)
Definition: cct_bundle.c:118
cct_node_t * hpcrun_cct_bundle_init_datacentric_node(cct_bundle_t *cct)
Definition: cct_bundle.c:170
cct_node_t * special_no_thread_node
Definition: cct_bundle.h:80
cct_node_t * hpcrun_cct_bundle_get_nothread_node(cct_bundle_t *cct)
Definition: cct_bundle.c:180
cct_node_t * special_datacentric_node
Definition: cct_bundle.h:78
cct_ctxt_t * ctxt
Definition: cct_bundle.h:82
cct_node_t * tree_root
Definition: cct_bundle.h:65
struct cct_bundle_t cct_bundle_t
cct_node_t * partial_unw_root
Definition: cct_bundle.h:74
void hpcrun_cct_bundle_init(cct_bundle_t *bundle, cct_ctxt_t *ctxt)
Definition: cct_bundle.c:85
cct_node_t * top
Definition: cct_bundle.h:63
cct_node_t * special_idle_node
Definition: cct_bundle.h:76
cct_node_t * thread_root
Definition: cct_bundle.h:72
Definition: cct.c:96
bool hpcrun_empty_cct(cct_bundle_t *cct)
Definition: cct_bundle.c:149
unsigned long num_nodes
Definition: cct_bundle.h:84
cct_node_t * hpcrun_cct_bundle_get_idle_node(cct_bundle_t *cct)
Definition: cct_bundle.c:159