HPCToolkit
sample_source_obj.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 SAMPLE_SOURCE_H
48
#define SAMPLE_SOURCE_H
49
50
#include <stdbool.h>
51
52
#include "
simple_oo.h
"
53
54
// OO macros for sample_sources
55
56
#define METHOD_DEF(retn,name,...) retn (*name)(struct sample_source_t* self, ##__VA_ARGS__)
57
58
// abbreviation macro for common case of void methods
59
#define VMETHOD_DEF(name,...) METHOD_DEF(void,name, ##__VA_ARGS__)
60
#define METHOD_FN(n,...) n(sample_source_t *self, ##__VA_ARGS__)
61
62
#include "
evlist.h
"
63
64
// A sample source "state"
65
// UNINIT and INIT refer to the source
66
// START and STOP are on a per-thread basis
67
68
typedef
enum
{
69
UNINIT
,
70
INIT
,
71
START
,
72
STOP
,
73
HARD_STOP
74
}
source_state_t
;
75
76
typedef
struct
{
77
void
*
ptr
;
78
}
source_info_t
;
79
80
typedef
enum
{
81
SS_HARDWARE
,
// use sample counters or other hardware.
82
// NOTE: *Currently limited to only 1 hardware class sample source*
83
SS_SOFTWARE
// software-based, e.g. synchronous samples.
84
}
ss_class_t
;
85
86
typedef
struct
sample_source_t
{
87
// common methods
88
89
VMETHOD_DEF
(add_event,
const
char
* ev_str);
90
VMETHOD_DEF
(store_event,
int
event_id,
long
thresh);
91
VMETHOD_DEF
(store_metric_id,
int
event_idx,
int
metric_id);
92
93
METHOD_DEF
(
int
, store_event_and_info,
int
event_id,
long
thresh,
int
metric_id,
void
*info);
94
METHOD_DEF
(
char
*, get_event_str);
95
METHOD_DEF
(
bool
, started);
96
97
// specific methods
98
99
VMETHOD_DEF
(init);
100
VMETHOD_DEF
(thread_init);
101
VMETHOD_DEF
(thread_init_action);
102
VMETHOD_DEF
(start);
103
VMETHOD_DEF
(thread_fini_action);
104
VMETHOD_DEF
(stop);
105
VMETHOD_DEF
(shutdown);
106
METHOD_DEF
(
bool
, supports_event,
const
char
* ev_str);
107
VMETHOD_DEF
(process_event_list,
int
lush_agents
);
108
VMETHOD_DEF
(gen_event_set,
int
lush_agents);
109
VMETHOD_DEF
(display_events);
110
111
// data
112
evlist_t
evl
;
// event list
113
int
sel_idx
;
// selection index of sample source
114
const
char
*
name
;
// text name of sample source
115
source_state_t
state
;
// state of sample source: limited to UNINIT or INIT
116
ss_class_t
cls
;
// kind of sample source: see ss_class_t typedef at top of file
117
int
sort_order
;
// registered list order: low to high
118
struct
sample_source_t
*
next_reg
;
// simple linked list of REGISTERED sample source objects
119
struct
sample_source_t
*
next_sel
;
// simple linked list of SELECTED sample source objects
120
121
}
sample_source_t
;
122
123
124
#endif // SAMPLE_SOURCE_H
SS_HARDWARE
Definition:
sample_source_obj.h:81
source_state_t
source_state_t
Definition:
sample_source_obj.h:68
sample_source_t::name
const char * name
Definition:
sample_source_obj.h:114
evlist.h
SS_SOFTWARE
Definition:
sample_source_obj.h:83
sample_source_t
Definition:
sample_source_obj.h:86
sample_source_t::next_sel
struct sample_source_t * next_sel
Definition:
sample_source_obj.h:119
source_info_t::ptr
void * ptr
Definition:
sample_source_obj.h:77
sample_source_t::sel_idx
int sel_idx
Definition:
sample_source_obj.h:113
ss_class_t
ss_class_t
Definition:
sample_source_obj.h:80
sample_source_t::VMETHOD_DEF
VMETHOD_DEF(add_event, const char *ev_str)
HARD_STOP
Definition:
sample_source_obj.h:73
UNINIT
Definition:
sample_source_obj.h:69
sample_source_t::cls
ss_class_t cls
Definition:
sample_source_obj.h:116
evlist_t
Definition:
evlist.h:66
sample_source_t
struct sample_source_t sample_source_t
sample_source_t::state
source_state_t state
Definition:
sample_source_obj.h:115
source_info_t
Definition:
sample_source_obj.h:76
sample_source_t::next_reg
struct sample_source_t * next_reg
Definition:
sample_source_obj.h:118
simple_oo.h
INIT
Definition:
sample_source_obj.h:70
sample_source_t::evl
evlist_t evl
Definition:
sample_source_obj.h:112
sample_source_t::METHOD_DEF
METHOD_DEF(int, store_event_and_info, int event_id, long thresh, int metric_id, void *info)
sample_source_t::sort_order
int sort_order
Definition:
sample_source_obj.h:117
START
Definition:
sample_source_obj.h:71
lush_agents
lush_agent_pool_t * lush_agents
Definition:
lush-backtrace.c:99
STOP
Definition:
sample_source_obj.h:72
src
tool
hpcrun
sample-sources
sample_source_obj.h
Generated by
1.8.13