7 #include <lttng/lttng.h>
9 static enum lttng_domain_type
get_domain_type(const char *domain
)
11 if (!strcmp("UST", domain
)) {
12 return LTTNG_DOMAIN_UST
;
13 } else if (!strcmp("KERNEL", domain
)) {
14 return LTTNG_DOMAIN_KERNEL
;
16 printf("Domain not supported\n");
21 static int process_channel(struct lttng_channel
*channel
)
28 ret
= lttng_channel_get_discarded_event_count(channel
, &uint64
);
33 printf("discarded_event_count: %" PRIu64
"\n", uint64
);
35 ret
= lttng_channel_get_lost_packet_count(channel
, &uint64
);
40 printf("lost packet: %" PRIu64
"\n", uint64
);
43 ret
= lttng_channel_get_monitor_timer_interval(channel
, &uint64
);
48 printf("monitor timer interval: %" PRIu64
"\n", uint64
);
50 ret
= lttng_channel_get_blocking_timeout(channel
, &int64
);
55 printf("blocking timeout: %" PRId64
"\n", int64
);
58 ret
= lttng_channel_set_blocking_timeout(channel
, 100);
64 ret
= lttng_channel_set_monitor_timer_interval(channel
, 100);
69 #endif /* LTTNG_2_10 */
75 int main(int argc
, char **argv
)
81 printf("missing parameters, session name, channel name, domain type\n");
85 const char *session_name
= argv
[1];
86 const char *channel_name
= argv
[2];
87 const char *domain_str
= argv
[3];
89 /* Domain related variables */
90 enum lttng_domain_type domain_type
= LTTNG_DOMAIN_NONE
;
91 struct lttng_domain
*domains
= NULL
;
92 struct lttng_domain domain
;
93 int domain_index
= -1;
95 /* Channel related variables */
96 struct lttng_channel
*channels
= NULL
;
97 int channel_index
= -1;
99 struct lttng_handle
*handle
= NULL
;
101 /* Find the domain we are interested in */
102 domain_type
= get_domain_type(domain_str
);
103 ret
= lttng_list_domains(session_name
, &domains
);
104 for (int i
= 0; i
< ret
; i
++) {
105 if (domains
[i
].type
== domain_type
) {
110 if (domain_index
< 0) {
111 printf("domain not found for session %s\n", session_name
);
118 handle
= lttng_create_handle(session_name
, &domains
[domain_index
]);
120 /* Find the channel we are interested in */
121 ret
= lttng_list_channels(handle
, &channels
);
122 for (int i
= 0; i
< ret
; i
++) {
123 if (!strcmp(channels
[i
].name
, channel_name
)) {
128 if (channel_index
< 0) {
129 printf("channel not found for session %s\n", session_name
);
134 ret
= process_channel(&channels
[channel_index
]);
140 lttng_destroy_handle(handle
);