Fix: add ustctl_has_perf_counters
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 12 Jan 2015 22:11:32 +0000 (17:11 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 12 Jan 2015 22:12:32 +0000 (17:12 -0500)
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 <mathieu.desnoyers@efficios.com>
include/lttng/ust-ctl.h
liblttng-ust-ctl/ustctl.c

index 40e831e585fb44facd555841256d1f0ed4063e80..8e60f0d8e4db572c4b7c4f32f7ed50534a241c8c 100644 (file)
@@ -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 {
index 49ae3e6cf94dfc12f6ae32c176841d8a8e71cc79..3554d13f4db59506275209d5294cfd0cf85ddd74 100644 (file)
@@ -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.
  */
This page took 0.026491 seconds and 4 git commands to generate.