trace: Get the trace file from the GALLIUM_TRACE option itself.

This commit is contained in:
José Fonseca 2008-08-16 18:45:00 +01:00
parent 145a45e9d6
commit 6a31bb6ad8
4 changed files with 12 additions and 13 deletions

View file

@ -8,7 +8,6 @@ To use do
ln -s libGL.so build/linux-x86-debug/gallium/winsys/xlib/libGL.so.1
export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/gallium/winsys/xlib
export GALLIUM_TRACE=y
ensure the right libGL.so is being picked by doing
@ -16,11 +15,11 @@ ensure the right libGL.so is being picked by doing
and then try running
glxinfo
GALLIUM_TRACE=tri.trace ./progs/trivial/tri
which should create a gallium.*.trace file, which is an XML file. You can view
copying trace.xsl and trace.css to the same directory, and opening with a
XSLT capable browser like Firefox or Internet Explorer.
which should create a tri.trace file, which is an XML file. You can view copying
trace.xsl to the same directory, and opening with a XSLT capable browser like
Firefox or Internet Explorer.
--
Jose Fonseca <jrfonseca@tungstengraphics.com>

View file

@ -218,12 +218,15 @@ trace_dump_trace_close(void)
boolean trace_dump_trace_begin()
{
if(!debug_get_bool_option("GALLIUM_TRACE", FALSE))
const char *filename;
filename = debug_get_option("GALLIUM_TRACE", NULL);
if(!filename)
return FALSE;
if(!stream) {
stream = trace_stream_create("gallium", "trace");
stream = trace_stream_create(filename);
if(!stream)
return FALSE;

View file

@ -47,18 +47,14 @@ struct trace_stream
struct trace_stream *
trace_stream_create(const char *name, const char *ext)
trace_stream_create(const char *filename)
{
struct trace_stream *stream;
static unsigned file_no = 0;
char filename[1024];
stream = CALLOC_STRUCT(trace_stream);
if(!stream)
goto error1;
snprintf(filename, sizeof(filename), "%s.%u.%s", name, file_no, ext);
#if defined(PIPE_OS_LINUX)
stream->file = fopen(filename, "w");
if(!stream->file)

View file

@ -39,11 +39,12 @@
#include "pipe/p_compiler.h"
struct trace_stream;
struct trace_stream *
trace_stream_create(const char *name, const char *ext);
trace_stream_create(const char *filename);
boolean
trace_stream_write(struct trace_stream *stream, const void *data, size_t size);