RE: AW: Patch to DorothyLocker
"Garth T Kidd" <garth-OnzZ1s1DREKDegMON/[email protected]> Sun, 26 Sep 2004 22:25:25 +1000
| Newsgroups | gmane.comp.pythin.pyds.devel |
|---|---|
| Organization | Deadly Bloody Serious |
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. ------=_NextPart_000_003B_01C4A417.BA311B40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Woo. Don't forget this patch. The ignores I was passing to DorothyLocker weren't quite right, so I'm reverting to doing it by name until I nut it out properly. -----Original Message----- From: Garth T Kidd [mailto:garth-OnzZ1s1DREKDegMON/[email protected]] Sent: Sunday, 26 September 2004 10:21 PM To: 'Georg Bauer'; 'Thomas Klaeger' Cc: 'pyds-dev-iYtK5bfT9M//Ad8WF/[email protected]' Subject: RE: AW: [Pyds-dev] Patch to DorothyLocker Checking out Thomas' suggestions and Georg's comments that DorothyLocker makes PyDS "horribly slow", I created ``stacktest.py`` (attached) to see just how much of a difference inspect.stack(context=0) makes. It looks like context=0 cuts inspect.stack down from ~4.2ms to 1.9ms per call for a stack depth of 10. CallingContext doesn't seem to add that much more -- 2.3ms per call at the same depth. Calling acquire AND release on a DorothyRLock at the same depth is 6.3ms per call. Georg, can you re-test with the latest? -----Original Message----- From: pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected] [mailto:pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected]] On Behalf Of Garth T Kidd Sent: Saturday, 25 September 2004 11:02 PM To: 'Georg Bauer'; 'Thomas Klaeger' Cc: pyds-dev-iYtK5bfT9M//Ad8WF/[email protected] Subject: RE: AW: [Pyds-dev] Patch to DorothyLocker Please find attached, a version with a lot more testing and adherence to pylint requirements; I'm thinking it's useful enough to be distributed in its own right. 40% of the code is now unit tests. :) I've also fixed a few bugs (yaay, tests!) and simplified some of the code. There's now just one list of things to ignore, for example, not two. Regards, Garth. -----Original Message----- From: pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected] [mailto:pyds-dev-admin-iYtK5bfT9M//Ad8WF/[email protected]] On Behalf Of Georg Bauer Sent: Friday, 24 September 2004 3:28 AM To: Thomas Klaeger Cc: Garth T Kidd; pyds-dev-iYtK5bfT9M//Ad8WF/[email protected] Subject: Re: AW: [Pyds-dev] Patch to DorothyLocker Hi! > The patch was wrong since thread.lock#acquire takes no keyword > arguments. It just needs to read acquire(1). Looks like that fixed it. At least it now starts fine, doesn't barf and stops fine on ctrl-c or sigkill. I commited it to CVS. Thanks. bye, Georg _______________________________________________ Pyds-dev mailing list Pyds-dev-iYtK5bfT9M//Ad8WF/[email protected] http://www.westfalen.de/cgi-bin/mailman/listinfo/pyds-dev ------=_NextPart_000_003B_01C4A417.BA311B40 Content-Type: application/octet-stream; name="20040926-1023.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="20040926-1023.diff" Index: PyDS/Tool.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /pyds/PyDS/PyDS/Tool.py,v retrieving revision 1.196 diff -c -c -r1.196 Tool.py *** PyDS/Tool.py 23 Sep 2004 12:35:14 -0000 1.196 --- PyDS/Tool.py 26 Sep 2004 12:23:13 -0000 *************** *** 49,55 **** =20 import PyDS.StructuredText import PyDS.CommandQueue ! from PyDS.DorothyLocker import DorothyRLock, LockAssertionError, = print_minitrace import PyDS =20 version =3D 'Python Desktop Server %s (http://pyds.muensterland.org/)' = % PyDS.__version__ --- 49,55 ---- =20 import PyDS.StructuredText import PyDS.CommandQueue ! from PyDS.DorothyLocker import DorothyRLock, LockAssertionError import PyDS =20 version =3D 'Python Desktop Server %s (http://pyds.muensterland.org/)' = % PyDS.__version__ *************** *** 1144,1150 **** self.rss =3D 0 self.hasAPI =3D 1 if _PyDS.verbose: ! self.lock =3D DorothyRLock(verbose=3DNone, name=3D'%s.lock' % name) = else: self.lock =3D threading.RLock() self.lockedFrom =3D None --- 1144,1154 ---- self.rss =3D 0 self.hasAPI =3D 1 if _PyDS.verbose: ! self.lock =3D DorothyRLock(verbose=3DNone,=20 ! name=3D'%s.lock' % name, ! ignores=3D['_acquire', '_release']) ! #self._acquire.func_code,=20 ! #self._release.func_code])=20 else: self.lock =3D threading.RLock() self.lockedFrom =3D None *************** *** 1377,1389 **** def _acquire(self, blocking=3D1): try:=20 return self.lock.acquire(blocking) ! except LockAssertionError, e:=20 ! msg, frame, t =3D e ! print "%s caught; lock was acquired in frame id %d at time %s" % ( ! msg, id(frame), time.ctime(t)) ! print "Trace of the initial lock acquisition:" =09 ! print_minitrace(frame) ! print raise # let the caller know we had a problem except:=20 print "_acquire: " --- 1381,1388 ---- def _acquire(self, blocking=3D1): try:=20 return self.lock.acquire(blocking) ! except LockAssertionError, ex:=20 ! ex.print_diagnosis() raise # let the caller know we had a problem except:=20 print "_acquire: " *************** *** 1396,1408 **** def _release(self): try:=20 return self.lock.release() ! except LockAssertionError, e:=20 ! msg, frame, t =3D e ! print "%s caught; lock was acquired in frame id %d at time %s" % ( ! msg, id(frame), time.ctime(t)) ! print "Trace of the initial lock acquisition:" ! print_minitrace(frame) ! raise # let the caller know we had a problem except:=20 print "_release: " (e, d, tb) =3D sys.exc_info() --- 1395,1403 ---- def _release(self): try:=20 return self.lock.release() ! except LockAssertionError, ex:=20 ! ex.print_diagnosis() ! raise except:=20 print "_release: " (e, d, tb) =3D sys.exc_info() ------=_NextPart_000_003B_01C4A417.BA311B40--