6964a6f97035a81495a0591527e151ef27fc6a90
2 * Copyright (c) 2011 David Goulet <david.goulet@polymtl.ca>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * as published by the Free Software Foundation; only version 2
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include <lttng/lttng.h>
34 int main(int argc
, char **argv
)
36 struct lttng_handle
*handle
= NULL
;
37 struct lttng_domain dom
;
38 struct lttng_event event
;
39 char *channel_name
= "channel0";
40 char *session_name
= "kernel_all_events_basic";
43 memset(&dom
, 0, sizeof(dom
));
44 memset(&event
, 0, sizeof(event
));
45 dom
.type
= LTTNG_DOMAIN_KERNEL
;
46 event
.type
= LTTNG_EVENT_TRACEPOINT
;
47 event
.loglevel_type
= LTTNG_EVENT_LOGLEVEL_ALL
;
49 printf("\nTesting tracing all kernel events:\n");
50 printf("-----------\n");
53 printf("Root access is needed.\nPlease run 'sudo make check' -- Aborting!\n");
58 printf("Missing session trace path\n");
62 printf("Creating tracing session (%s): ", argv
[1]);
63 if ((ret
= lttng_create_session(session_name
, argv
[1])) < 0) {
64 printf("error creating the session : %s\n", lttng_strerror(ret
));
69 printf("Creating session handle: ");
70 if ((handle
= lttng_create_handle(session_name
, &dom
)) == NULL
) {
71 printf("error creating handle: %s\n", lttng_strerror(ret
));
76 printf("Enabling all kernel events: ");
77 if ((ret
= lttng_enable_event(handle
, &event
, channel_name
)) < 0) {
78 printf("error enabling event: %s\n", lttng_strerror(ret
));
83 printf("Start tracing: ");
84 if ((ret
= lttng_start_tracing(session_name
)) < 0) {
85 printf("error starting tracing: %s\n", lttng_strerror(ret
));
92 printf("Stop tracing: ");
93 if ((ret
= lttng_stop_tracing(session_name
)) < 0) {
94 printf("error stopping tracing: %s\n", lttng_strerror(ret
));
99 printf("Destroy tracing session: ");
100 if ((ret
= lttng_destroy_session(session_name
)) < 0) {
101 printf("error destroying session: %s\n", lttng_strerror(ret
));
110 assert(handle
!= NULL
);
115 lttng_destroy_session(session_name
);
116 lttng_destroy_handle(handle
);
This page took 0.059175 seconds and 3 git commands to generate.