From: Mathieu Desnoyers Date: Mon, 12 Jan 2015 22:11:32 +0000 (-0500) Subject: Fix: add ustctl_has_perf_counters X-Git-Tag: v2.6.0~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1fd7b0dab12b14e63dfe0587cd4c703f5114919a;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 195f29c0..b44d9e34 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1639,6 +1639,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. */