On Fri, Jan 3, 2014 at 4:49 PM, Lauri Kasanen <c...@gmx.com> wrote: > No measurable overhead when off (glxgears within 0.5%). > > Signed-off-by: Lauri Kasanen <c...@gmx.com> > --- > src/gallium/drivers/radeon/r600_pipe_common.c | 32 > +++++++++++++++++++++++++++ > src/gallium/drivers/radeon/r600_pipe_common.h | 1 + > src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 17 ++++++++++++++ > src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 9 ++++++++ > src/gallium/winsys/radeon/drm/radeon_winsys.h | 6 +++++ > 5 files changed, 65 insertions(+) > > diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c > b/src/gallium/drivers/radeon/r600_pipe_common.c > index 28921be..121aa49 100644 > --- a/src/gallium/drivers/radeon/r600_pipe_common.c > +++ b/src/gallium/drivers/radeon/r600_pipe_common.c > @@ -26,11 +26,18 @@ > > #include "r600_pipe_common.h" > #include "r600_cs.h" > +#include "../../winsys/radeon/drm/radeon_drm_winsys.h" > +#include "os/os_time.h" > #include "tgsi/tgsi_parse.h" > #include "util/u_format_s3tc.h" > #include "util/u_upload_mgr.h" > #include <inttypes.h> > > +#ifdef __GLIBC__ > +#define _GNU_SOURCE > +#include <errno.h> > +#endif > + > static const struct debug_named_value common_debug_options[] = { > /* logging */ > { "tex", DBG_TEX, "Print texture info" }, > @@ -38,6 +45,7 @@ static const struct debug_named_value > common_debug_options[] = { > { "compute", DBG_COMPUTE, "Print compute info" }, > { "vm", DBG_VM, "Print virtual addresses when creating resources" }, > { "trace_cs", DBG_TRACE_CS, "Trace cs and write rlockup_<csid>.c file > with faulty cs" }, > + { "bostats", DBG_BO_STATS, "Write bo statistics to > /tmp/bostats.<pid>[.name]" }, > > /* shaders */ > { "fs", DBG_FS, "Print fetch shaders" }, > @@ -209,6 +217,24 @@ bool r600_common_screen_init(struct r600_common_screen > *rscreen, > return false; > } > > + if (rscreen->debug_flags & DBG_BO_STATS) { > + char statsfile[80]; > + const pid_t pid = getpid(); > + > +#ifdef __GLIBC__ > + snprintf(statsfile, 80, "/tmp/bostats.%u.%s", pid, > program_invocation_short_name); > +#else > + snprintf(statsfile, 80, "/tmp/bostats.%u", pid); > +#endif > + > + rscreen->ws->bo_stats_file = fopen(statsfile, "w"); > + if (!rscreen->ws->bo_stats_file) > + fprintf(stderr, "Failed to open bo stats file %s\n", > statsfile); > + else > + fprintf(rscreen->ws->bo_stats_file, "Started at > %llu\n", > + stats_time_get(ws));
Another nit: the other stats seems to use "@%llu" instead of "at %llu". But looking a bit more about this, since all code-sites for stat_time_get() seems to be variations of: if (ws->bo_stats_file) { fprintf(..., stats_time_get(ws)); } ...perhaps stats_time_get is a too low-level abstraction? I'm not saying it is, just asking :) _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev