/[pdpsoft]/nl.nikhef.ndpf.groupviews/branches/RB-2.1.1/ndpf-gv-mkplots
ViewVC logotype

Diff of /nl.nikhef.ndpf.groupviews/branches/RB-2.1.1/ndpf-gv-mkplots

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2424 by templon, Fri Sep 9 18:33:30 2011 UTC revision 2425 by templon, Fri Sep 9 19:03:22 2011 UTC
# Line 106  import glob Line 106  import glob
106    
107  ### function definitions  ### function definitions
108    
109  def doplot(grouplist, dbtype, psize, timetag, sizeargs, timeargs):  def doplot(grouplist, dbtype, psize, timetag, sizeargs, timeargs, pcents):
110    
111      defs = list()      defs = list()
112      plots = list()      plots = list()
# Line 120  def doplot(grouplist, dbtype, psize, tim Line 120  def doplot(grouplist, dbtype, psize, tim
120      for idx in range(len(grouplist)):      for idx in range(len(grouplist)):
121          group = grouplist[idx]          group = grouplist[idx]
122          pdefstr = 'AREA' ':' + group + colors[idx] + ':' + group          pdefstr = 'AREA' ':' + group + colors[idx] + ':' + group
123            if pcents:
124                pdefstr = pdefstr + ' (' + "%f5.1" % (pcents[group]) + ')'
125          pdefstr = pdefstr + '\\n'          pdefstr = pdefstr + '\\n'
126          if idx > 0:          if idx > 0:
127              pdefstr = pdefstr + ':STACK'              pdefstr = pdefstr + ':STACK'
# Line 175  def makeplots(prangedef): Line 177  def makeplots(prangedef):
177      running_files = glob.glob(DATADIR+'*.running.rrd')      running_files = glob.glob(DATADIR+'*.running.rrd')
178      for db in running_files:      for db in running_files:
179          group = db[len(DATADIR):db.find('.running.rrd')]          group = db[len(DATADIR):db.find('.running.rrd')]
         if group == "total":  
             continue  
180          tup = rrdtool.fetch(db,'AVERAGE','-r', repr(resolu),          tup = rrdtool.fetch(db,'AVERAGE','-r', repr(resolu),
181                              '-s', repr(start), '-e', repr(end))                              '-s', repr(start), '-e', repr(end))
182          vallist = [0] # start with zero, in case no vals returned, get zero as answer          vallist = [0] # start with zero, in case no vals returned, get zero as answer
# Line 184  def makeplots(prangedef): Line 184  def makeplots(prangedef):
184              val = tup2[0]              val = tup2[0]
185              if val:              if val:
186                  vallist.append(val)                  vallist.append(val)
187          tgroup[group] = sum(vallist)          if group == "total":
188                totval = sum(vallist)
189            else:
190                tgroup[group] = sum(vallist)
191    
192        pgroup = dict()
193        for g in tgroup.keys():
194            pgroup[g] = tgroup[g]/totval
195        
196      groups_sorted = sorted(tgroup, key=tgroup.get, reverse=False)      groups_sorted = sorted(tgroup, key=tgroup.get, reverse=False)
197      topgroups=groups_sorted[-NUMGROUPS:]      topgroups=groups_sorted[-NUMGROUPS:]
198    
# Line 200  def makeplots(prangedef): Line 207  def makeplots(prangedef):
207    
208      ### block generating plots ###      ### block generating plots ###
209    
210      
211      for dbtype in ['queued', 'running', 'waittime']:      for dbtype in ['queued', 'running', 'waittime']:
212            
213            ### this is a bit of a hack : we only want pgroups for when it's
214            ### a 'running' database and we don't want it for timetag hour.
215            ### fix this up here
216    
217            if dbtype == 'running' and timetag != 'hr':
218                percents = pgroup
219            else:
220                percents = None
221          for psize in ['small', 'large']:          for psize in ['small', 'large']:
222              if dbtype == 'waittime':              if dbtype == 'waittime':
223                  doplot_wait(topgroups, dbtype, psize, prangedef['timetag'],                  doplot_wait(topgroups, dbtype, psize, prangedef['timetag'],
# Line 210  def makeplots(prangedef): Line 227  def makeplots(prangedef):
227              else:              else:
228                  doplot(topgroups, dbtype, psize, prangedef['timetag'],                  doplot(topgroups, dbtype, psize, prangedef['timetag'],
229                         prangedef['sizeargs'],                         prangedef['sizeargs'],
230                         prangedef['timeargs']                         prangedef['timeargs'],
231                           percents
232                         )                         )
233    
234  for k in plotrangedef.keys():  for k in plotrangedef.keys():

Legend:
Removed from v.2424  
changed lines
  Added in v.2425

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28