Added total for used modules and users to the module statistics.

This commit is contained in:
Christoph Niethammer 2013-06-12 18:01:16 +00:00
parent 9cc4d9a9e6
commit 6da3aaaa36

View file

@ -11,6 +11,8 @@ from optparse import OptionParser
modules = list()
modulestats = dict()
moduleusers = dict()
total_modules = 0
total_users = set()
logdir = '/sw/laki/hlrs/system/modules/logs/'
enddate = datetime.date.today()
@ -50,6 +52,8 @@ for logfilename in os.listdir(logdir) :
user = line.split()[-3][5:] # remove user: in front
if options.nohpc and 'hpc' in user :
continue
total_users.add(user)
total_modules = total_modules + 1
if module not in modules:
modules.append(module)
modulestats[module] = 1
@ -73,4 +77,7 @@ print "-"*78
for (v,m) in sorted( ((v,k) for k,v in modulestats.iteritems()), reverse=True) :
print "{0:60s}{1:>8d} {2:>8d}".format(m, v, len(moduleusers[m].keys()))
#print moduleusers[m]
print "-"*78
print "{0:60s}{1:>8d} {2:>8d}".format('total', total_modules, len(total_users))
#print sorted([ (u) for u in total_users ])
print "-"*78