perf scripting python: Use Py_FatalError instead of die()
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 10 May 2016 15:33:52 +0000 (12:33 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 11 May 2016 15:24:57 +0000 (12:24 -0300)
It probably is equivalent, but that seems to be the "pythonic" way of
dieing? Anyway, one less die() in the tools/perf codebase.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Link: http://lkml.kernel.org/n/tip-nlzgepdv2818zs4e7faif9tu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/scripting-engines/trace-event-python.c

index 1546b749a3a34af6ed4bb89d33a5d6ccbaada4af..73ee12d96c33ff77599638aee59131b0cdd9b61d 100644 (file)
@@ -408,8 +408,11 @@ static void python_process_tracepoint(struct perf_sample *sample,
        if (!t)
                Py_FatalError("couldn't create Python tuple");
 
-       if (!event)
-               die("ug! no event found for type %d", (int)evsel->attr.config);
+       if (!event) {
+               snprintf(handler_name, sizeof(handler_name),
+                        "ug! no event found for type %" PRIu64, (u64)evsel->attr.config);
+               Py_FatalError(handler_name);
+       }
 
        pid = raw_field_value(event, "common_pid", data);