Fix: add missing UST perf counter support check
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 12 Jan 2015 22:14:52 +0000 (17:14 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 14 Jan 2015 20:09:21 +0000 (15:09 -0500)
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>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/trace-ust.c

index 999f0dfc21e75f4e988476be894adcff3e33f4bc..5f41bd764308a812806f623bdfb2ed24c09b838d 100644 (file)
@@ -474,7 +474,12 @@ int trace_ust_context_type_event_to_ust(enum lttng_event_context_type type)
                utype = LTTNG_UST_CONTEXT_IP;
                break;
        case LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER:
-               utype = LTTNG_UST_CONTEXT_PERF_THREAD_COUNTER;
+               if (!ustctl_has_perf_counters()) {
+                       utype = -1;
+                       WARN("Perf counters not implemented in UST");
+               } else {
+                       utype = LTTNG_UST_CONTEXT_PERF_THREAD_COUNTER;
+               }
                break;
        default:
                ERR("Invalid UST context");
This page took 0.03291 seconds and 4 git commands to generate.