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:06:01 +0000 (15:06 -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 a3e25aa8adfed1532b95ffb22b67849f21e282fb..4f06f1b06d149635080e99edc616978cca3ae7ba 100644 (file)
@@ -470,7 +470,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.025497 seconds and 4 git commands to generate.