Commit | Line | Data |
---|---|---|
ebdb334b JR |
1 | /* |
2 | * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: LGPL-2.1-only | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef LTTNG_MAP_QUERY_INTERNAL_H | |
9 | #define LTTNG_MAP_QUERY_INTERNAL_H | |
10 | ||
11 | #include <stdint.h> | |
12 | ||
13 | #include <common/payload.h> | |
14 | #include <common/payload-view.h> | |
15 | ||
16 | #include <lttng/lttng.h> | |
17 | #include <lttng/map/map-query.h> | |
18 | ||
19 | struct lttng_map_query { | |
20 | enum lttng_map_query_config_cpu config_cpu; | |
21 | enum lttng_map_query_config_buffer config_buffer; | |
22 | enum lttng_map_query_config_app_bitness config_bitness; | |
23 | ||
24 | /* | |
25 | * Aggregate the values of all selected CPUs in a single table. | |
26 | */ | |
27 | bool sum_by_cpu; | |
28 | ||
29 | /* | |
30 | * Aggregate the values of all selected bitness in a single table. | |
31 | */ | |
32 | bool sum_by_app_bitness; | |
33 | ||
34 | /* | |
35 | * Aggregate the values of all selected uid or pid in a single table. | |
36 | */ | |
37 | bool sum_by_uid; | |
38 | bool sum_by_pid; | |
39 | ||
40 | char *key_filter; | |
41 | struct lttng_dynamic_array cpu_array; | |
42 | struct lttng_dynamic_array uid_array; | |
43 | struct lttng_dynamic_array pid_array; | |
44 | }; | |
45 | ||
46 | struct lttng_map_query_comm { | |
47 | uint32_t key_filter_length; /* Include '\0' */ | |
48 | ||
49 | uint8_t config_cpu; | |
50 | uint8_t config_buffer; | |
51 | uint8_t config_app_bitness; | |
52 | ||
53 | uint8_t sum_by_cpu; | |
54 | uint8_t sum_by_app_bitness; | |
55 | uint8_t sum_by_uid; | |
56 | uint8_t sum_by_pid; | |
57 | ||
58 | uint32_t cpu_count; | |
59 | uint32_t uid_count; | |
60 | uint32_t pid_count; | |
61 | /* | |
62 | * key_filter + | |
63 | * (cpu_count * int) + (uid_count * uid_t) + (pid_count * pid_t) | |
64 | */ | |
65 | char payload[]; | |
66 | } LTTNG_PACKED; | |
67 | ||
68 | LTTNG_HIDDEN | |
69 | enum lttng_map_query_config_cpu lttng_map_query_get_config_cpu( | |
70 | const struct lttng_map_query *query); | |
71 | ||
72 | LTTNG_HIDDEN | |
73 | enum lttng_map_query_config_buffer lttng_map_query_get_config_buffer( | |
74 | const struct lttng_map_query *query); | |
75 | ||
76 | LTTNG_HIDDEN | |
77 | enum lttng_map_query_config_app_bitness lttng_map_query_get_config_app_bitness( | |
78 | const struct lttng_map_query *query); | |
79 | ||
80 | LTTNG_HIDDEN | |
81 | bool lttng_map_query_get_config_sum_by_cpu( | |
82 | const struct lttng_map_query *query); | |
83 | ||
84 | LTTNG_HIDDEN | |
85 | bool lttng_map_query_get_config_sum_by_pid( | |
86 | const struct lttng_map_query *query); | |
87 | ||
88 | LTTNG_HIDDEN | |
89 | bool lttng_map_query_get_config_sum_by_uid( | |
90 | const struct lttng_map_query *query); | |
91 | ||
92 | // Not supported yet. | |
93 | LTTNG_HIDDEN | |
94 | enum lttng_map_query_status lttng_map_query_set_sum_by_app_bitness( | |
95 | struct lttng_map_query *query, bool sum_by_app_bitness); | |
96 | ||
97 | // Not supported yet. | |
98 | LTTNG_HIDDEN | |
99 | enum lttng_map_query_status lttng_map_query_set_sum_by_uid( | |
100 | struct lttng_map_query *query, bool sum_by_uid); | |
101 | ||
102 | LTTNG_HIDDEN | |
103 | bool lttng_map_query_get_config_sum_by_app_bitness( | |
104 | const struct lttng_map_query *query); | |
105 | ||
106 | LTTNG_HIDDEN | |
107 | enum lttng_map_query_status lttng_map_query_get_cpu_count( | |
108 | const struct lttng_map_query *query, unsigned int *count); | |
109 | ||
110 | LTTNG_HIDDEN | |
111 | enum lttng_map_query_status lttng_map_query_get_uid_count( | |
112 | const struct lttng_map_query *query, unsigned int *count); | |
113 | ||
114 | LTTNG_HIDDEN | |
115 | enum lttng_map_query_status lttng_map_query_get_pid_count( | |
116 | const struct lttng_map_query *query, unsigned int *count); | |
117 | ||
118 | LTTNG_HIDDEN | |
119 | enum lttng_map_query_status lttng_map_query_get_cpu_at_index( | |
120 | const struct lttng_map_query *query, unsigned int index, | |
121 | int *cpu); | |
122 | ||
123 | LTTNG_HIDDEN | |
124 | enum lttng_map_query_status lttng_map_query_get_uid_at_index( | |
125 | const struct lttng_map_query *query, unsigned int index, | |
126 | uid_t *uid); | |
127 | ||
128 | LTTNG_HIDDEN | |
129 | enum lttng_map_query_status lttng_map_query_get_pid_at_index( | |
130 | const struct lttng_map_query *query, unsigned int index, | |
131 | pid_t *pid); | |
132 | ||
133 | LTTNG_HIDDEN | |
134 | enum lttng_map_query_status lttng_map_query_get_key_filter( | |
135 | const struct lttng_map_query *query, const char **key_filter); | |
136 | ||
137 | LTTNG_HIDDEN | |
138 | ssize_t lttng_map_query_create_from_payload(struct lttng_payload_view *view, | |
139 | struct lttng_map_query **query); | |
140 | ||
141 | LTTNG_HIDDEN | |
142 | int lttng_map_query_serialize(const struct lttng_map_query *query, | |
143 | struct lttng_payload *payload); | |
144 | ||
145 | #endif /* LTTNG_MAP_QUERY_INTERNAL_H */ |