/offlineimap/head: changeset 164
Added profile mode (-P) and updated the documentation with it.
This commit is contained in:
@ -18,7 +18,13 @@
|
||||
|
||||
from threading import *
|
||||
from StringIO import StringIO
|
||||
import sys, traceback, thread
|
||||
import sys, traceback, thread, profile
|
||||
|
||||
profiledir = None
|
||||
|
||||
def setprofiledir(newdir):
|
||||
global profiledir
|
||||
profiledir = newdir
|
||||
|
||||
######################################################################
|
||||
# General utilities
|
||||
@ -81,10 +87,20 @@ class ExitNotifyThread(Thread):
|
||||
"""This class is designed to alert a "monitor" to the fact that a thread has
|
||||
exited and to provide for the ability for it to find out why."""
|
||||
def run(self):
|
||||
global exitcondition, exitthreads
|
||||
global exitcondition, exitthreads, profiledir
|
||||
self.threadid = thread.get_ident()
|
||||
try:
|
||||
Thread.run(self)
|
||||
if not profiledir: # normal case
|
||||
Thread.run(self)
|
||||
else:
|
||||
prof = profile.Profile()
|
||||
try:
|
||||
prof = prof.runctx("Thread.run(self)", globals(), locals())
|
||||
except SystemExit:
|
||||
pass
|
||||
prof.dump_stats( \
|
||||
profiledir + "/" + str(self.threadid) + "_" + \
|
||||
self.getName() + ".prof")
|
||||
except:
|
||||
self.setExitCause('EXCEPTION')
|
||||
self.setExitException(sys.exc_info()[1])
|
||||
|
@ -1,8 +1,8 @@
|
||||
productname = 'OfflineIMAP'
|
||||
versionstr = "3.0.3"
|
||||
revno = long('$Rev: 152 $'[6:-2])
|
||||
revno = long('$Rev: 164 $'[6:-2])
|
||||
revstr = "Rev %d" % revno
|
||||
datestr = '$Date: 2002-07-21 15:46:40 -0500 (Sun, 21 Jul 2002) $'
|
||||
datestr = '$Date: 2002-07-22 15:48:15 -0500 (Mon, 22 Jul 2002) $'
|
||||
|
||||
|
||||
versionlist = versionstr.split(".")
|
||||
@ -40,16 +40,29 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"""
|
||||
|
||||
cmdhelp = """
|
||||
offlineimap [ -1 ] [ -a accountlist ] [ -c configfile ]
|
||||
[ -d ] [ -u interface ]
|
||||
offlineimap [ -1 ] [ -P profiledir ] [ -a accountlist ] [
|
||||
-c configfile ] [ -d ] [ -o ] [ -u interface ]
|
||||
|
||||
offlineimap -h | --help
|
||||
|
||||
-1 Disable all multithreading operations and use
|
||||
-1 Disable all multithreading operations and use
|
||||
solely a single-thread sync. This effectively sets
|
||||
the maxsyncaccounts and all maxconnections configu-
|
||||
ration file variables to 1.
|
||||
|
||||
-P profiledir
|
||||
Sets OfflineIMAP into profile mode. The program
|
||||
will create profiledir (it must not already exist).
|
||||
As it runs, Python profiling information about each
|
||||
thread is logged into profiledir. Please note:
|
||||
This option is present for debugging and optimiza-
|
||||
tion only, and should NOT be used unless you have a
|
||||
specific reason to do so. It will significantly
|
||||
slow program performance, may reduce reliability,
|
||||
and can generate huge amounts of data. You must
|
||||
use the -1 option when you use -P.
|
||||
|
||||
|
||||
-a accountlist
|
||||
Overrides the accounts section in the config file.
|
||||
Lets you specify a particular account or set of
|
||||
@ -72,14 +85,23 @@ cmdhelp = """
|
||||
remove that from the debugging output before send-
|
||||
ing it to anyone else.
|
||||
|
||||
-o Run only once, ignoring any autorefresh setting in
|
||||
the config file.
|
||||
|
||||
-h, --help
|
||||
Show summary of options.
|
||||
|
||||
-u interface
|
||||
Specifies an alternative user interface module to
|
||||
use. This overrides the default specified in the
|
||||
configuration file. The UI specified with -u will
|
||||
be forced to be used, even if its isuable() method
|
||||
states that it cannot be. Use this option with
|
||||
Specifies an alternative user interface module to
|
||||
use. This overrides the default specified in the
|
||||
configuration file. The UI specified with -u will
|
||||
be forced to be used, even if its isuable() method
|
||||
states that it cannot be. Use this option with
|
||||
care.
|
||||
|
||||
The pre-defined options are Tk.TKUI (a graphical
|
||||
interface), TTY.TTYUI (a text-mode interface), Non-
|
||||
interactive.Basic (a non-interactive mode suitable
|
||||
for cronning), and Noninteractive.Quiet (a mode
|
||||
that generates no output except for errors).
|
||||
"""
|
||||
|
Reference in New Issue
Block a user