From: David Goulet Date: Wed, 3 Aug 2011 20:28:21 +0000 (-0400) Subject: Change list kernel events to list tracepoints X-Git-Tag: v2.0-pre7~15 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2a71efd5ae4e4bc9fe52154782d4a0a8f867d55a;p=lttng-tools.git Change list kernel events to list tracepoints Remove lttng_list_kernel_events to lttng_list_tracepoints(domain). Make it generic to lttng domain and specific for tracepoints which are static instrumentation. Signed-off-by: David Goulet --- diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index bd8cf45a8..89f9db3d3 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -218,7 +218,7 @@ extern int lttng_destroy_session(const char *name); extern int lttng_list_sessions(struct lttng_session **sessions); /* - * List registered domain(s) of the session. + * List registered domain(s) of a session. * * Return the size of the "lttng_domain" array. Caller must free(3). */ @@ -243,11 +243,12 @@ extern int lttng_list_events(struct lttng_domain *domain, struct lttng_event **events); /* - * List available kernel tracing events + * List available tracepoints of domain. * * Return the size of the "lttng_event" array. Caller must free(3). */ -extern int lttng_list_kernel_events(struct lttng_event **events); +extern int lttng_list_tracepoints(struct lttng_domain *domain, + struct lttng_event **events); /* * Check if a session daemon is alive. @@ -332,11 +333,4 @@ extern int lttng_disable_event(struct lttng_domain *domain, const char *name, extern int lttng_disable_channel(struct lttng_domain *domain, const char *name); -/* - * List kernel events. - * - * Return the size of the allocated event list. Caller must free(3) the data. - */ -//extern int lttng_list_events(struct lttng_domain *domain, char **event_list); - #endif /* _LTTNG_H */ diff --git a/liblttngctl/liblttngctl.c b/liblttngctl/liblttngctl.c index 0cc3268f7..17bb4105a 100644 --- a/liblttngctl/liblttngctl.c +++ b/liblttngctl/liblttngctl.c @@ -468,16 +468,32 @@ int lttng_disable_channel(struct lttng_domain *domain, const char *name) } /* - * List all available kernel events. + * List all available tracepoints of domain. * - * Return the size (bytes) of the list and set the event_list array. + * Return the size (bytes) of the list and set the events array. * On error, return negative value. */ -int lttng_list_kernel_events(struct lttng_event **events) +int lttng_list_tracepoints(struct lttng_domain *domain, + struct lttng_event **events) { int ret; - ret = ask_sessiond(LTTNG_KERNEL_LIST_EVENTS, (void **) events); + ret = copy_lttng_domain(domain); + if (ret < 0) { + return -LTTCOMM_UNKNOWN_DOMAIN; + } + + switch (domain->type) { + case LTTNG_DOMAIN_KERNEL: + ret = ask_sessiond(LTTNG_KERNEL_LIST_EVENTS, (void **) events); + break; + case LTTNG_DOMAIN_UST: + ret = LTTCOMM_NOT_IMPLEMENTED; + break; + default: + ret = LTTCOMM_UNKNOWN_DOMAIN; + break; + }; return ret / sizeof(struct lttng_event); } diff --git a/lttng/commands/list.c b/lttng/commands/list.c index bce40ff6c..3c779c3a3 100644 --- a/lttng/commands/list.c +++ b/lttng/commands/list.c @@ -113,10 +113,13 @@ static int list_kernel_events(void) { int i, size; struct lttng_event *event_list; + struct lttng_domain dom; DBG("Getting all tracing events"); - size = lttng_list_kernel_events(&event_list); + dom.type = LTTNG_DOMAIN_KERNEL; + + size = lttng_list_tracepoints(&dom, &event_list); if (size < 0) { ERR("Unable to list kernel events"); return size;