Limit the number of events enabled in live
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 6 Dec 2012 15:49:10 +0000 (10:49 -0500)
committerJulien Desfossez <jdesfossez@efficios.com>
Sat, 19 Oct 2013 16:02:38 +0000 (12:02 -0400)
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 <jdesfossez@efficios.com>
src/lttngtop.c

index dd48a88fd90049a8e95c94dac70fc48334c99097..ce7607af05de18785209d4227475688fbdecbcfd 100644 (file)
@@ -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;
        }
This page took 0.03262 seconds and 4 git commands to generate.