cell: enable #define CACHE_STATS to print a cache report upon exit
authorBrian <brian.paul@tungstengraphics.com>
Tue, 1 Apr 2008 17:05:32 +0000 (11:05 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 1 Apr 2008 17:05:32 +0000 (11:05 -0600)
src/gallium/drivers/cell/spu/spu_dcache.c
src/gallium/drivers/cell/spu/spu_dcache.h
src/gallium/drivers/cell/spu/spu_main.c

index a1701d80d18f57fb4cd297ca76d5cf0843e6fec5..167404cdc54b05c24aacb1d40177583e6abc0dbe 100644 (file)
@@ -36,6 +36,7 @@
 #define CACHE_SET_TAGID(set)  (((set) & 0x03) + TAG_DCACHE0)
 #define CACHE_LOG2NNWAY       2
 #define CACHE_LOG2NSETS       6
+/*#define CACHE_STATS           1*/
 #include <cache-api.h>
 
 /* Yes folks, this is ugly.
@@ -123,3 +124,20 @@ spu_dcache_mark_dirty(unsigned ea, unsigned size)
           ? (entry & ~CACHELINE_VALID) : entry;
    }
 }
+
+
+/**
+ * Print cache utilization report
+ */
+void
+spu_dcache_report(void)
+{
+#ifdef CACHE_STATS
+   if (spu.init.id == 0) {
+      printf("SPU 0: Texture cache report:\n");
+      cache_pr_stats(data);
+   }
+#endif
+}
+
+
index 7a06b8c25afa8263a4ebf730a3679289176d49d0..39a19eb31b523c787797929983d1e1b83f04f870 100644 (file)
@@ -31,4 +31,7 @@ spu_dcache_fetch_unaligned(qword *dst, unsigned ea, unsigned size);
 extern void
 spu_dcache_mark_dirty(unsigned ea, unsigned size);
 
+extern void
+spu_dcache_report(void);
+
 #endif /* SPU_DCACHE_H */
index 7f0473d198cc2886d294cec0c6bd71eb78fad2b1..5b5a570a3cd98fcac4764d3d0459adc16ca6c15e 100644 (file)
@@ -629,6 +629,8 @@ main_loop(void)
 
    if (Debug)
       printf("SPU %u: Exit main loop\n", spu.init.id);
+
+   spu_dcache_report();
 }