From e19cbadffcb99236f3e98f9ec6a838804f143108 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 1 Sep 2011 22:44:38 -0400 Subject: allow tracemark() to take variable args Signed-off-by: Steven Rostedt --- src/cyclictest/cyclictest.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index db5c228..c5cc807 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -336,13 +337,23 @@ static int trace_file_exists(char *name) return stat(path, &sbuf) ? 0 : 1; } -static void tracemark(char *comment) +#define TRACEBUFSIZ 1024 +static __thread char tracebuf[TRACEBUFSIZ]; + +static void tracemark(char *fmt, ...) { + va_list ap; + int len; + /* bail out if we're not tracing */ /* or if the kernel doesn't support trace_mark */ if (tracemark_fd < 0) return; - write(tracemark_fd, comment, strlen(comment)); + + va_start(ap, fmt); + len = vsnprintf(tracebuf, TRACEBUFSIZ, fmt, ap); + va_end(ap); + write(tracemark_fd, tracebuf, len); } void tracing(int on) -- cgit v1.2.3