forked from rib/gputop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgputop-client-c.h
More file actions
129 lines (107 loc) · 4.22 KB
/
Copy pathgputop-client-c.h
File metadata and controls
129 lines (107 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* GPU Top
*
* Copyright (C) 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include <stdint.h>
#include <stdlib.h>
#include <stdarg.h>
#include <inttypes.h>
#include <string.h>
#include <sys/types.h>
#include "gputop-oa-counters.h"
#ifdef __cplusplus
extern "C" {
#endif
enum gputop_cc_stream_type {
STREAM_TYPE_OA,
STREAM_TYPE_TRACEPOINT,
};
enum gputop_cc_field_type {
FIELD_TYPE_INT8,
FIELD_TYPE_UINT8,
FIELD_TYPE_INT16,
FIELD_TYPE_UINT16,
FIELD_TYPE_INT32,
FIELD_TYPE_UINT32,
FIELD_TYPE_INT64,
FIELD_TYPE_UINT64,
};
#define GPUTOP_CC_MAX_FIELDS 20
struct gputop_cc_tracepoint_field {
char *name;
enum gputop_cc_field_type type;
int offset;
};
struct gputop_cc_stream {
enum gputop_cc_stream_type type;
/*
* OA streams...
*/
struct gputop_metric_set *oa_metric_set;
/* Aggregation may happen accross multiple perf data messages
* so we may need to copy the last report so that aggregation
* can continue with the next message... */
uint8_t *continuation_report;
/*
* Tracepoint streams...
*/
struct gputop_cc_tracepoint_field fields[GPUTOP_CC_MAX_FIELDS];
int n_fields;
/* Can be used for binding structure into JavaScript, e.g. to
* associate a corresponding v8::Object... */
void *js_priv;
};
int gputop_cc_get_counter_id(const char *guid, const char *counter_symbol_name);
void gputop_cc_handle_i915_perf_message(struct gputop_cc_stream *stream,
uint8_t *data, int data_len,
struct gputop_cc_oa_accumulator **accumulators,
int n_accumulators,
int ctx_hw_id,
int idle_flag);
void gputop_cc_reset_system_properties(void);
void gputop_cc_set_system_property(const char *name, double value);
void gputop_cc_set_system_property_string(const char *name, const char *value);
void gputop_cc_update_system_metrics(void);
struct gputop_cc_stream *
gputop_cc_oa_stream_new(const char *guid);
void gputop_cc_stream_destroy(struct gputop_cc_stream *stream);
struct gputop_cc_oa_accumulator *
gputop_cc_oa_accumulator_new(struct gputop_cc_stream *stream,
int aggregation_period,
bool enable_ctx_switch_events);
void gputop_cc_oa_accumulator_set_period(struct gputop_cc_oa_accumulator *accumulator,
uint32_t aggregation_period);
void gputop_cc_oa_accumulator_destroy(struct gputop_cc_oa_accumulator *accumulator);
struct gputop_cc_stream *gputop_cc_tracepoint_stream_new(void);
void gputop_cc_tracepoint_add_field(struct gputop_cc_stream *stream,
const char *name,
const char *type,
int offset,
int size,
bool is_signed);
void gputop_cc_handle_tracepoint_message(struct gputop_cc_stream *stream,
uint8_t *data,
int len);
#ifdef __cplusplus
}
#endif