Added total for used modules and users to the module statistics.
This commit is contained in:
parent
9cc4d9a9e6
commit
6da3aaaa36
1 changed files with 8 additions and 1 deletions
|
@ -11,6 +11,8 @@ from optparse import OptionParser
|
||||||
modules = list()
|
modules = list()
|
||||||
modulestats = dict()
|
modulestats = dict()
|
||||||
moduleusers = dict()
|
moduleusers = dict()
|
||||||
|
total_modules = 0
|
||||||
|
total_users = set()
|
||||||
|
|
||||||
logdir = '/sw/laki/hlrs/system/modules/logs/'
|
logdir = '/sw/laki/hlrs/system/modules/logs/'
|
||||||
enddate = datetime.date.today()
|
enddate = datetime.date.today()
|
||||||
|
@ -50,6 +52,8 @@ for logfilename in os.listdir(logdir) :
|
||||||
user = line.split()[-3][5:] # remove user: in front
|
user = line.split()[-3][5:] # remove user: in front
|
||||||
if options.nohpc and 'hpc' in user :
|
if options.nohpc and 'hpc' in user :
|
||||||
continue
|
continue
|
||||||
|
total_users.add(user)
|
||||||
|
total_modules = total_modules + 1
|
||||||
if module not in modules:
|
if module not in modules:
|
||||||
modules.append(module)
|
modules.append(module)
|
||||||
modulestats[module] = 1
|
modulestats[module] = 1
|
||||||
|
@ -73,4 +77,7 @@ print "-"*78
|
||||||
for (v,m) in sorted( ((v,k) for k,v in modulestats.iteritems()), reverse=True) :
|
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 "{0:60s}{1:>8d} {2:>8d}".format(m, v, len(moduleusers[m].keys()))
|
||||||
#print moduleusers[m]
|
#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
|
||||||
|
|
Loading…
Reference in a new issue