aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2014-09-26 14:44:34 -0400
committerSteven Rostedt <rostedt@goodmis.org>2015-06-10 15:11:36 -0400
commit3b5e76ab3d526733cc474139135300ce65b585ab (patch)
tree906d5258b9167c62bd5040e8b1759211dc3a0f6c
parent5e814403f528bed7c7a549651a38d12dbf76ae4b (diff)
downloadtrace-cmd-3b5e76ab3d526733cc474139135300ce65b585ab.tar.gz
trace-cmd: Allow python tools to supress warning() and pr_stat()
trace-cmd has a lot of built in warning() and pr_stat() output that is noisy when you are using the python bindings. This patch provides overrides for these two functions and the ability for python scripts to optionally turn them off. With this patch I can silence all of these extraneous print messages from within my python script. Link: http://lkml.kernel.org/r/1411757074-29117-1-git-send-email-jbacik@fb.com Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--ctracecmd.i30
1 files changed, 30 insertions, 0 deletions
diff --git a/ctracecmd.i b/ctracecmd.i
index 3b80f01b..e91d068e 100644
--- a/ctracecmd.i
+++ b/ctracecmd.i
@@ -34,6 +34,36 @@ static int python_callback(struct trace_seq *s,
struct event_format *event,
void *context);
+static int skip_output = 0;
+
+static void py_supress_trace_output(void)
+{
+ skip_output = 1;
+}
+
+void pr_stat(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (skip_output)
+ return;
+ va_start(ap, fmt);
+ __vpr_stat(fmt, ap);
+ va_end(ap);
+}
+
+void warning(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (skip_output)
+ return;
+
+ va_start(ap, fmt);
+ __vwarning(fmt, ap);
+ va_end(ap);
+}
+
PyObject *convert_pevent(unsigned long pevent)
{
void *pev = (void *)pevent;