Improve RenderTrace. r=debug
authorBenoit Girard <b56girard@gmail.com>
Fri, 24 Feb 2012 17:41:16 -0500
changeset 89253 28019f9120c1fc856752a7b7c0d77cdef3e6f360
parent 89252 d50f3465ce1710d620672b6b6f0e3171169e9fbe
child 89254 eabfd284eb428c009d8c554df61f7ded9e49977c
push id22242
push userkgupta@mozilla.com
push dateWed, 14 Mar 2012 15:19:09 +0000
treeherdermozilla-central@936ef50fa498 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdebug
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Improve RenderTrace. r=debug
gfx/layers/RenderTrace.cpp
gfx/layers/RenderTrace.h
--- a/gfx/layers/RenderTrace.cpp
+++ b/gfx/layers/RenderTrace.cpp
@@ -92,13 +92,27 @@ void RenderTraceInvalidateStart(Layer *a
     aColor,
     (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
 }
 void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor) {
   // Clear with an empty rect
   RenderTraceInvalidateStart(aLayer, aColor, nsIntRect());
 }
 
+void renderTraceEventStart(const char *aComment, const char *aColor) {
+  printf_stderr("%s RENDERTRACE %u fillrect #%s 0 0 10 10\n",
+    aComment, (int)PR_IntervalNow(), aColor);
+}
+
+void renderTraceEventEnd(const char *aComment, const char *aColor) {
+  printf_stderr("%s RENDERTRACE %u fillrect #%s 0 0 0 0\n",
+    aComment, (int)PR_IntervalNow(), aColor);
+}
+
+void renderTraceEventEnd(const char *aColor) {
+  renderTraceEventEnd("", aColor);
+}
+
 }
 }
 
 #endif
 
--- a/gfx/layers/RenderTrace.h
+++ b/gfx/layers/RenderTrace.h
@@ -37,42 +37,55 @@
 
 // This is a general tool that will let you visualize platform operation.
 // Currently used for the layer system, the general syntax allows this
 // tools to be adapted to trace other operations.
 //
 // For the front end see: https://github.com/staktrace/rendertrace
 
 // Uncomment this line to enable RENDERTRACE
-#define MOZ_RENDERTRACE
+//#define MOZ_RENDERTRACE
 
 #ifndef GFX_RENDERTRACE_H
-//#define GFX_RENDERTRACE_H
+#define GFX_RENDERTRACE_H
 
 #include "gfx3DMatrix.h"
 #include "nsRect.h"
 
 namespace mozilla {
 namespace layers {
 
 class Layer;
 
 void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform = gfx3DMatrix(), bool aReset = true);
 
 void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect);
 void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor);
 
+void renderTraceEventStart(const char *aComment, const char *aColor);
+void renderTraceEventEnd(const char *aComment, const char *aColor);
+void renderTraceEventEnd(const char *aColor);
+
 #ifndef MOZ_RENDERTRACE
 inline void RenderTraceLayers(Layer *aLayer, const char *aColor, const gfx3DMatrix aRootTransform, bool aReset)
 {}
 
 inline void RenderTraceInvalidateStart(Layer *aLayer, const char *aColor, const nsIntRect aRect)
 {}
 
 inline void RenderTraceInvalidateEnd(Layer *aLayer, const char *aColor)
 {}
 
+inline void renderTraceEventStart(const char *aComment, const char *aColor)
+{}
+
+inline void renderTraceEventEnd(const char *aComment, const char *aColor)
+{}
+
+inline void renderTraceEventEnd(const char *aColor)
+{}
+
 #endif // MOZ_RENDERTRACE
 
 }
 }
 
 #endif //GFX_RENDERTRACE_H