[Twisted-Python] [OT] Make Python Faster
Jp Calderone
exarkun at intarweb.us
Fri Feb 28 21:27:48 MST 2003
On Fri, Feb 28, 2003 at 11:20:00PM -0500, Jp Calderone wrote:
Helps to attach the file.
Jp
--
up 20 days, 8:29, 10 users, load average: 0.24, 0.33, 0.37
-------------- next part --------------
Index: twistd.py
===================================================================
RCS file: /cvs/Twisted/twisted/scripts/twistd.py,v
retrieving revision 1.38
diff -u -r1.38 twistd.py
--- twistd.py 1 Mar 2003 04:03:28 -0000 1.38
+++ twistd.py 1 Mar 2003 04:06:12 -0000
@@ -1,4 +1,4 @@
-# Twisted, the Framework of Your Internet
+
# Copyright (C) 2001 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
@@ -439,6 +439,7 @@
log.msg("Failed to unlink PID file:")
log.deferr()
log.msg("Server Shut Down.")
+ report(application)
def run():
@@ -455,3 +456,32 @@
os._exit(1)
runApp(config)
+
+
+def rle(l):
+ import types
+ newl = []
+ lastel = None
+ count = 0
+ for elt in l:
+ if elt == lastel:
+ count = count + 1
+ continue
+ elif lastel is not None:
+ if isinstance(lastel, types.ListType):
+ lastel = rle(lastel)
+ newl.append([lastel, count])
+ lastel = elt
+ count = 1
+ if isinstance(lastel, types.ListType):
+ lastel = rle(lastel)
+ newl.append([lastel, count])
+ return newl
+
+def report(app):
+ email = 'your at email.address'
+ if hasattr(sys, 'getdxp') and app.processName:
+ import xmlrpclib
+ dxp = xmlrpclib.ServerProxy("http://manatee.mojam.com:7304")
+ dxp.add_dx_info(app.processName, email, sys.version_info[:3], rle(sys.getdxp()))
+ log.msg('Reported dxp results')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20030228/c259ccb4/attachment.sig>
More information about the Twisted-Python
mailing list