SoW-2020-0003: Trace Hit Counters
[lttng-tools.git] / include / lttng / map / map-query-internal.h
CommitLineData
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
19struct 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
46struct 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
68LTTNG_HIDDEN
69enum lttng_map_query_config_cpu lttng_map_query_get_config_cpu(
70 const struct lttng_map_query *query);
71
72LTTNG_HIDDEN
73enum lttng_map_query_config_buffer lttng_map_query_get_config_buffer(
74 const struct lttng_map_query *query);
75
76LTTNG_HIDDEN
77enum lttng_map_query_config_app_bitness lttng_map_query_get_config_app_bitness(
78 const struct lttng_map_query *query);
79
80LTTNG_HIDDEN
81bool lttng_map_query_get_config_sum_by_cpu(
82 const struct lttng_map_query *query);
83
84LTTNG_HIDDEN
85bool lttng_map_query_get_config_sum_by_pid(
86 const struct lttng_map_query *query);
87
88LTTNG_HIDDEN
89bool lttng_map_query_get_config_sum_by_uid(
90 const struct lttng_map_query *query);
91
92// Not supported yet.
93LTTNG_HIDDEN
94enum 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.
98LTTNG_HIDDEN
99enum lttng_map_query_status lttng_map_query_set_sum_by_uid(
100 struct lttng_map_query *query, bool sum_by_uid);
101
102LTTNG_HIDDEN
103bool lttng_map_query_get_config_sum_by_app_bitness(
104 const struct lttng_map_query *query);
105
106LTTNG_HIDDEN
107enum lttng_map_query_status lttng_map_query_get_cpu_count(
108 const struct lttng_map_query *query, unsigned int *count);
109
110LTTNG_HIDDEN
111enum lttng_map_query_status lttng_map_query_get_uid_count(
112 const struct lttng_map_query *query, unsigned int *count);
113
114LTTNG_HIDDEN
115enum lttng_map_query_status lttng_map_query_get_pid_count(
116 const struct lttng_map_query *query, unsigned int *count);
117
118LTTNG_HIDDEN
119enum 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
123LTTNG_HIDDEN
124enum 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
128LTTNG_HIDDEN
129enum 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
133LTTNG_HIDDEN
134enum lttng_map_query_status lttng_map_query_get_key_filter(
135 const struct lttng_map_query *query, const char **key_filter);
136
137LTTNG_HIDDEN
138ssize_t lttng_map_query_create_from_payload(struct lttng_payload_view *view,
139 struct lttng_map_query **query);
140
141LTTNG_HIDDEN
142int lttng_map_query_serialize(const struct lttng_map_query *query,
143 struct lttng_payload *payload);
144
145#endif /* LTTNG_MAP_QUERY_INTERNAL_H */
This page took 0.028745 seconds and 5 git commands to generate.