浏览代码

*** empty log message ***

Dave Schuyler 22 年之前
父节点
当前提交
8183512ad6
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      direct/src/directutil/DeltaProfiler.py

+ 28 - 0
direct/src/directutil/DeltaProfiler.py

@@ -0,0 +1,28 @@
+
+from time import time
+
+class DeltaProfiler:
+    """
+    This is a Python specific ProfileTimer.cxx.
+    It's not related directly to the ProfileTimer code, it just
+    shares some concepts.
+    """
+    def __init__(self, name=""):
+        self.name=name
+        self.priorLabel = ""
+        self.priorTime = 0
+        self.active=0
+
+    def printDeltaTime(self, label):
+        if self.active:
+            deltaTime=time()-self.priorTime
+            print "%s DeltaTime %-25s to %-25s: %3.5f"%(
+                self.name,
+                self.priorLabel,
+                label,
+                deltaTime)
+            self.priorLabel=label
+            # The printing time is not included in the timing.
+            # This is intentional.
+            self.priorTime=time()
+