From: Mathieu Desnoyers Date: Mon, 12 Jan 2015 22:11:32 +0000 (-0500) Subject: Fix: add ustctl_has_perf_counters X-Git-Tag: v2.7.0-rc1~63 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=57201bb34b010e8127ea824e12fd0a7e4b56fe0b;p=lttng-ust.git Fix: add ustctl_has_perf_counters Allow sessiond to report whether performance counters are supported by UST on the architecture as soon as the user try to enable a perf counter context. Fixes #851 Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h index 40e831e5..8e60f0d8 100644 --- a/include/lttng/ust-ctl.h +++ b/include/lttng/ust-ctl.h @@ -238,6 +238,9 @@ int ustctl_get_stream_id(struct ustctl_consumer_stream *stream, int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream, uint64_t *ts); +/* returns whether UST has perf counters support. */ +int ustctl_has_perf_counters(void); + /* event registry management */ enum ustctl_socket_type { diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 49ae3e6c..3554d13f 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1638,6 +1638,22 @@ int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream, return client_cb->current_timestamp(buf, handle, ts); } +#if defined(__x86_64__) || defined(__i386__) + +int ustctl_has_perf_counters(void) +{ + return 1; +} + +#else + +int ustctl_has_perf_counters(void) +{ + return 0; +} + +#endif + /* * Returns 0 on success, negative error value on error. */