summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott D Phillips <scott.d.phillips@intel.com>2016-05-17 15:29:07 -0700
committerSean V Kelley <seanvk@posteo.de>2016-05-22 16:35:23 -0700
commit81db15a2ef6235d3154b112698d2504ba8db0cfc (patch)
treeb432b827edb5177710278eb3eff4c530b36428d9
parentcfed3696b6eff33f7bab16c91a61738ae52b34d0 (diff)
downloadlibva-81db15a2ef6235d3154b112698d2504ba8db0cfc.tar.gz
trace: Add `va_TracePrint`, `va_TraceVPrint` static functions
These functions are similar to va_TraceMsg() but without emitting a timestamp. Signed-off-by: Scott D Phillips <scott.d.phillips@intel.com> Reviewed-by: Sean V Kelley <seanvk@posteo.de>
-rw-r--r--va/va_trace.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/va/va_trace.c b/va/va_trace.c
index f632176..5c345f2 100644
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -877,10 +877,9 @@ void va_TraceEnd(VADisplay dpy)
((VADisplayContextP)dpy)->vatrace = NULL;
}
-static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
+static void va_TraceVPrint(struct trace_context *trace_ctx, const char *msg, va_list args)
{
FILE *fp = NULL;
- va_list args;
if (!(trace_flag & VA_TRACE_FLAG_LOG)
|| !trace_ctx->plog_file)
@@ -888,25 +887,44 @@ static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
fp = trace_ctx->plog_file->fp_log;
if (msg) {
- struct timeval tv;
-
- if (gettimeofday(&tv, NULL) == 0)
- fprintf(fp, "[%04d.%06d]",
- (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
-
- if(trace_ctx->trace_context != VA_INVALID_ID)
- fprintf(fp,
- "[ctx 0x%08x]", trace_ctx->trace_context);
- else
- fprintf(fp, "[ctx none]");
-
- va_start(args, msg);
vfprintf(fp, msg, args);
- va_end(args);
} else
fflush(fp);
}
+static void va_TracePrint(struct trace_context *trace_ctx, const char *msg, ...)
+{
+ va_list args;
+ va_start(args, msg);
+ va_TraceVPrint(trace_ctx, msg, args);
+ va_end(args);
+}
+
+static void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
+{
+ va_list args;
+ struct timeval tv;
+
+ if (!msg) {
+ va_TracePrint(trace_ctx, msg);
+ return;
+ }
+
+ if (gettimeofday(&tv, NULL) == 0)
+ va_TracePrint(trace_ctx, "[%04d.%06d]",
+ (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
+
+ if(trace_ctx->trace_context != VA_INVALID_ID)
+ va_TracePrint(trace_ctx,
+ "[ctx 0x%08x]", trace_ctx->trace_context);
+ else
+ va_TracePrint(trace_ctx, "[ctx none]");
+
+ va_start(args, msg);
+ va_TraceVPrint(trace_ctx, msg, args);
+ va_end(args);
+}
+
static void va_TraceSurface(VADisplay dpy, VAContextID context)
{
unsigned int i, j;