Dolda2000 GitWeb
/
pdm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
441160a
)
Introduced paired events for processes.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 23 Nov 2011 00:53:58 +0000
(
01:53
+0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 23 Nov 2011 00:53:58 +0000
(
01:53
+0100)
pdm/perf.py
patch
|
blob
|
blame
|
history
diff --git
a/pdm/perf.py
b/pdm/perf.py
index
0ff02a1
..
de2dba5
100644
(file)
--- a/
pdm/perf.py
+++ b/
pdm/perf.py
@@
-1,4
+1,4
@@
-import os, sys, resource, time, socket
+import os, sys, resource, time, socket
, threading
class attrinfo(object):
def __init__(self, desc = None):
class attrinfo(object):
def __init__(self, desc = None):
@@
-98,6
+98,25
@@
class event(object):
def __init__(self):
self.time = time.time()
def __init__(self):
self.time = time.time()
+idlock = threading.Lock()
+procevid = 0
+class startevent(event):
+ def __init__(self):
+ super(startevent, self).__init__()
+ global procevid
+ idlock.acquire()
+ try:
+ self.id = procevid
+ procevid += 1
+ finally:
+ idlock.release()
+
+class finishevent(event):
+ def __init__(self, start, aborted):
+ super(finishevent, self).__init__()
+ self.id = start.id
+ self.aborted = aborted
+
sysres = staticdir()
itime = time.time()
ires = resource.getrusage(resource.RUSAGE_SELF)
sysres = staticdir()
itime = time.time()
ires = resource.getrusage(resource.RUSAGE_SELF)