summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/SCons/scons-local/SCons/Debug.py')
-rw-r--r--3rdParty/SCons/scons-local/SCons/Debug.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/3rdParty/SCons/scons-local/SCons/Debug.py b/3rdParty/SCons/scons-local/SCons/Debug.py
index cc7041d..f7805eb 100644
--- a/3rdParty/SCons/scons-local/SCons/Debug.py
+++ b/3rdParty/SCons/scons-local/SCons/Debug.py
@@ -7,7 +7,7 @@ needed by most users.
"""
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -29,11 +29,12 @@ needed by most users.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Debug.py 4043 2009/02/23 09:06:45 scons"
+__revision__ = "src/engine/SCons/Debug.py 4761 2010/04/04 14:04:44 bdeegan"
import os
import string
import sys
+import time
# Recipe 14.10 from the Python Cookbook.
try:
@@ -196,14 +197,24 @@ if sys.platform == 'win32':
else:
TraceDefault = '/dev/tty'
-def Trace(msg, file=None, mode='w'):
+TimeStampDefault = None
+StartTime = time.time()
+PreviousTime = StartTime
+
+def Trace(msg, file=None, mode='w', tstamp=None):
"""Write a trace message to a file. Whenever a file is specified,
it becomes the default for the next call to Trace()."""
global TraceDefault
+ global TimeStampDefault
+ global PreviousTime
if file is None:
file = TraceDefault
else:
TraceDefault = file
+ if tstamp is None:
+ tstamp = TimeStampDefault
+ else:
+ TimeStampDefault = tstamp
try:
fp = TraceFP[file]
except KeyError:
@@ -212,6 +223,10 @@ def Trace(msg, file=None, mode='w'):
except TypeError:
# Assume we were passed an open file pointer.
fp = file
+ if tstamp:
+ now = time.time()
+ fp.write('%8.4f %8.4f: ' % (now - StartTime, now - PreviousTime))
+ PreviousTime = now
fp.write(msg)
fp.flush()