Added world.threadsSpawned, logging of the number of threads spawned, and added the information to cpustats.

This commit is contained in:
Jeremy Fincher 2003-04-20 16:15:35 +00:00
parent cc61041491
commit 80e4dfbe63
3 changed files with 6 additions and 2 deletions

View File

@ -330,11 +330,13 @@ class FunCommands(callbacks.Privmsg):
'children have taken %s seconds of user time and %s seconds'\ 'children have taken %s seconds of user time and %s seconds'\
' of system time for a total of %s seconds of CPU time. ' \ ' of system time for a total of %s seconds of CPU time. ' \
'I\'ve taken a total of %s%% of this computer\'s time. ' \ 'I\'ve taken a total of %s%% of this computer\'s time. ' \
'I currently have %s active %s.' %\ 'Out of %s spawned %s, I have %s active.' %\
(user, system, user + system, (user, system, user + system,
childUser, childSystem, childUser + childSystem, childUser, childSystem, childUser + childSystem,
(user+system+childUser+childSystem)/timeRunning, (user+system+childUser+childSystem)/timeRunning,
threads, threads == 1 and 'thread' or 'threads') world.threadsSpawned,
world.threadsSpawned == 1 and 'thread' or 'threads',
threads)
irc.reply(msg, response) irc.reply(msg, response)
def uptime(self, irc, msg, args): def uptime(self, irc, msg, args):

View File

@ -300,6 +300,7 @@ class IrcObjectProxy:
class CommandThread(threading.Thread): class CommandThread(threading.Thread):
def __init__(self, command, irc, msg, args): def __init__(self, command, irc, msg, args):
self.command = command self.command = command
world.threadsSpawned += 1
self.commandName = command.im_func.func_name self.commandName = command.im_func.func_name
self.className = command.im_class.__name__ self.className = command.im_class.__name__
name = '%s.%s with args %r' % (self.className, self.commandName, args) name = '%s.%s with args %r' % (self.className, self.commandName, args)

View File

@ -52,6 +52,7 @@ version = '0.70.0'
startedAt = 0.0 startedAt = 0.0
threadsSpawned = 0
### ###
# End Global Values. # End Global Values.
### ###