From 20e26b34f91e6d21e407aa64f39a8a0283402ddf Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Thu, 6 Dec 2012 10:49:10 -0500 Subject: [PATCH] Limit the number of events enabled in live Instead of enabling all the kernel events, we now only activate the events we need. On an Intel Core 2 Duo, the CPU usage of LTTngTop in live mode pass from 3% to 1%. Signed-off-by: Julien Desfossez --- src/lttngtop.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/lttngtop.c b/src/lttngtop.c index 3923574..1e1b427 100644 --- a/src/lttngtop.c +++ b/src/lttngtop.c @@ -1217,10 +1217,32 @@ int setup_live_tracing() } memset(&ev, '\0', sizeof(struct lttng_event)); - //sprintf(ev.name, "sched_switch"); ev.type = LTTNG_EVENT_TRACEPOINT; + sprintf(ev.name, "sched_switch"); if ((ret = lttng_enable_event(handle, &ev, channel_name)) < 0) { - fprintf(stderr,"error enabling event : %s\n", + fprintf(stderr,"error enabling event %s : %s\n", + ev.name, + helper_lttcomm_get_readable_code(ret)); + goto error_session; + } + sprintf(ev.name, "sched_process_free"); + if ((ret = lttng_enable_event(handle, &ev, channel_name)) < 0) { + fprintf(stderr,"error enabling event %s : %s\n", + ev.name, + helper_lttcomm_get_readable_code(ret)); + goto error_session; + } + sprintf(ev.name, "lttng_statedump_process_state"); + if ((ret = lttng_enable_event(handle, &ev, channel_name)) < 0) { + fprintf(stderr,"error enabling event %s : %s\n", + ev.name, + helper_lttcomm_get_readable_code(ret)); + goto error_session; + } + sprintf(ev.name, "lttng_statedump_file_descriptor"); + if ((ret = lttng_enable_event(handle, &ev, channel_name)) < 0) { + fprintf(stderr,"error enabling event %s : %s\n", + ev.name, helper_lttcomm_get_readable_code(ret)); goto error_session; } -- 2.34.1