HPCToolkit
cct_dump.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_DUMP_H
48 #define CCT_DUMP_H
49 #ifndef _FLG
50 #define _FLG CCT
51 #endif
52 
53 #include <stdint.h>
54 
55 #include <cct/cct.h>
56 #include <messages/messages.h>
57 
58 #define TLIM 1
59 
60 #ifndef TLIM
61 #define TL(E) E
62 #define TLS(S) S
63 #else
64 #include <hpcrun/thread_data.h>
65 #define TL(E) ((TD_GET(id) == TLIM) && (E))
66 #define TLS(S) if (TD_GET(id) == TLIM) S
67 #endif
68 
69 
70 #define TF(_FLG, ...) TMSG(_FLG, __VA_ARGS__)
71 
72 static void
73 l_dump(cct_node_t* node, cct_op_arg_t arg, size_t level)
74 {
75  char p[level+1];
76 
77  if (! node) return;
78 
79  memset(&p[0], ' ', level);
80  p[level] = '\0';
81 
82  int32_t id = hpcrun_cct_persistent_id(node);
83  cct_addr_t* adr = hpcrun_cct_addr(node);
84 
85  TF(_FLG, "%s[%d: (%d, %p)]", &p[0], id,
86  adr->ip_norm.lm_id, adr->ip_norm.lm_ip);
87 }
88 
89 static void
91 {
93 }
94 
95 #endif // CCT_DUMP_H
cct_node_t * node
Definition: cct.c:128
uintptr_t lm_ip
Definition: ip-normalized.h:78
void * cct_op_arg_t
Definition: cct.h:186
#define TF(_FLG,...)
Definition: cct_dump.h:70
#define _FLG
Definition: cct_dump.h:50
static void l_dump(cct_node_t *node, cct_op_arg_t arg, size_t level)
Definition: cct_dump.h:73
ip_normalized_t ip_norm
Definition: cct_addr.h:66
int32_t hpcrun_cct_persistent_id(cct_node_t *x)
Definition: cct.c:363
static void dump_cct(cct_node_t *cct)
Definition: cct_dump.h:90
#define NULL
Definition: ElfHelper.cpp:85
Definition: cct.c:96
static void hpcrun_cct_walk_node_1st(cct_node_t *cct, cct_op_t op, cct_op_arg_t arg)
Definition: cct.h:226
cct_addr_t * hpcrun_cct_addr(cct_node_t *node)
Definition: cct.c:369