[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1351528309-87705-2-git-send-email-dsahern@gmail.com>
Date: Mon, 29 Oct 2012 10:31:41 -0600
From: David Ahern <dsahern@...il.com>
To: acme@...stprotocols.net, linux-kernel@...r.kernel.org
Cc: mingo@...nel.org, peterz@...radead.org, fweisbec@...il.com,
David Ahern <dsahern@...il.com>
Subject: [PATCH 1/9] perf python: add ui stubs file
stdio based implementations of ui_xxxx based functions for the python
library. Needed for patch 3 - consolidating open counters method.
Signed-off-by: David Ahern <dsahern@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
---
tools/perf/util/python-ext-sources | 1 +
tools/perf/util/python_stubs.c | 54 ++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
create mode 100644 tools/perf/util/python_stubs.c
diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index c40c2d3..92d9e05 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -19,3 +19,4 @@ util/debugfs.c
util/rblist.c
util/strlist.c
../../lib/rbtree.c
+util/python_stubs.c
diff --git a/tools/perf/util/python_stubs.c b/tools/perf/util/python_stubs.c
new file mode 100644
index 0000000..7b31880
--- /dev/null
+++ b/tools/perf/util/python_stubs.c
@@ -0,0 +1,54 @@
+/*
+ * stubs for various ui-specific functions for the python library
+ */
+
+#include <stdio.h>
+#include "debug.h"
+
+#if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT)
+#undef ui__error
+#endif
+
+int verbose;
+
+int ui__warning(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ return 0;
+}
+
+int ui__error(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ return 0;
+}
+
+int ui__error_paranoid(void)
+{
+ return ui__error("Permission error - are you root?\n"
+ "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
+ " -1 - Not paranoid at all\n"
+ " 0 - Disallow raw tracepoint access for unpriv\n"
+ " 1 - Disallow cpu events for unpriv\n"
+ " 2 - Disallow kernel profiling for unpriv\n");
+}
+
+int eprintf(int level, const char *fmt, ...)
+{
+ va_list args;
+ int ret = 0;
+
+ va_start(args, fmt);
+ ret = vfprintf(stderr, fmt, args);
+ va_end(args);
+
+ return ret;
+}
--
1.7.10.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists