瀏覽代碼

reduce freqeuncy of report texmgr stats to limit perf impact

cxgeorge 24 年之前
父節點
當前提交
1e40d6c899
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      panda/src/dxgsg/dxGraphicsStateGuardian.cxx

+ 10 - 4
panda/src/dxgsg/dxGraphicsStateGuardian.cxx

@@ -793,16 +793,22 @@ render_frame(const AllAttributesWrapper &initial_state) {
 
 
 #ifdef DO_PSTATS
 #ifdef DO_PSTATS
   if (_texmgrmem_total_pcollector.is_active()) {
   if (_texmgrmem_total_pcollector.is_active()) {
-    report_texmgr_stats();
+      #define TICKS_PER_GETTEXINFO (2*1000)   // 2 second interval
+      static DWORD LastTickCount=0;
+      DWORD CurTickCount=GetTickCount();
+
+      if (CurTickCount-LastTickCount > TICKSPERINFO) {
+          LastTickCount=CurTickCount;
+          report_texmgr_stats();
+      }
   }
   }
 #endif
 #endif
 
 
 #ifdef PRINT_TEXSTATS
 #ifdef PRINT_TEXSTATS
     {
     {
-
-#define TICKSPERINFO (3*1000)
+        #undef TICKS_PER_GETTEXINFO
+        #define TICKS_PER_GETTEXINFO (3*1000)
         static DWORD LastTickCount=0;
         static DWORD LastTickCount=0;
-
         DWORD CurTickCount=GetTickCount();
         DWORD CurTickCount=GetTickCount();
 
 
         if (CurTickCount-LastTickCount > TICKSPERINFO) {
         if (CurTickCount-LastTickCount > TICKSPERINFO) {