Пример #1
0
def plot_ratios(ts, tmid, ratio, ratio2, rate, var, fig, ax, full):
    # Compute y-axis min and max, expand the limits by 10%
    ymin = min(numpy.minimum(ratio, ratio2))
    ymax = max(numpy.maximum(ratio, ratio2))
    ymin, ymax = tspl_utils.expand_range(ymin, ymax, 0.1)

    print '---------------------'
    ax[0].plot(tmid / 3600, ratio)
    ax[0].hold = True
    ax[0].plot(tmid / 3600, ratio2)
    ax[0].legend(('Std Dev', 'Max Diff'), loc=4)
    ax[1].hold = True
    ymin1 = 0.  # This is wrong in general, but we don't want the min to be > 0.
    ymax1 = 0.
    for v in rate:
        ymin1 = min(ymin1, min(v))
        ymax1 = max(ymax1, max(v))
        ax[1].plot(tmid / 3600, v)

    ymin1, ymax1 = tspl_utils.expand_range(ymin1, ymax1, 0.1)

    title = ts.title + ', V: %(V)-8.3g' % {'V': var}
    plt.suptitle(title)
    ax[0].set_xlabel('Time (hr)')
    ax[0].set_ylabel('Imbalance Ratios')
    ax[1].set_xlabel('Time (hr)')
    ax[1].set_ylabel('Total ' + ts.label(ts.k1[0], ts.k2[0]) + '/s')
    ax[0].set_ylim(bottom=ymin, top=ymax)
    ax[1].set_ylim(bottom=ymin1, top=ymax1)

    fname = '_'.join(
        ['graph', ts.j.id, ts.k1[0], ts.k2[0], 'imbalance' + full])
    fig.savefig(fname)
    plt.close()
Пример #2
0
def plot_ratios(ts,tmid,ratio,ratio2,rate,var,fig,ax,full):
  # Compute y-axis min and max, expand the limits by 10%
  ymin=min(numpy.minimum(ratio,ratio2))
  ymax=max(numpy.maximum(ratio,ratio2))
  ymin,ymax=tspl_utils.expand_range(ymin,ymax,0.1)

  print '---------------------'
  ax[0].plot(tmid/3600,ratio)
  ax[0].hold=True
  ax[0].plot(tmid/3600,ratio2)
  ax[0].legend(('Std Dev','Max Diff'), loc=4)
  ax[1].hold=True
  ymin1=0. # This is wrong in general, but we don't want the min to be > 0.
  ymax1=0.
  for v in rate:
    ymin1=min(ymin1,min(v))
    ymax1=max(ymax1,max(v))
    ax[1].plot(tmid/3600,v)

  ymin1,ymax1=tspl_utils.expand_range(ymin1,ymax1,0.1)

  title=ts.title + ', V: %(V)-8.3g' % {'V' : var}
  plt.suptitle(title)
  ax[0].set_xlabel('Time (hr)')
  ax[0].set_ylabel('Imbalance Ratios')
  ax[1].set_xlabel('Time (hr)')
  ax[1].set_ylabel('Total ' + ts.label(ts.k1[0],ts.k2[0]) + '/s')
  ax[0].set_ylim(bottom=ymin,top=ymax)
  ax[1].set_ylim(bottom=ymin1,top=ymax1)

  fname='_'.join(['graph',ts.j.id,ts.k1[0],ts.k2[0],'imbalance'+full])
  fig.savefig(fname)
  plt.close()
Пример #3
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-f", help="Set full mode", action="store_true")
    parser.add_argument("key1", help="First key", nargs="?", default="amd64_core")
    parser.add_argument("key2", help="Second key", nargs="?", default="SSE_FLOPS")
    parser.add_argument("filearg", help="File, directory, or quoted" " glob pattern", nargs="?", default="jobs")

    n = parser.parse_args()
    filelist = tspl_utils.getfilelist(n.filearg)

    for file in filelist:
        try:
            if n.f:
                full = "_full"
                ts = tspl.TSPLBase(file, [n.key1], [n.key2])
            else:
                full = ""
                ts = tspl.TSPLSum(file, [n.key1], [n.key2])
        except tspl.TSPLException as e:
            continue

        if not tspl_utils.checkjob(ts, 3600, 16):  # 1 hour, 16way only
            continue
        elif ts.numhosts < 2:  # At least 2 hosts
            print ts.j.id + ": 1 host"
            continue

        print ts.j.id

        tmid = (ts.t[:-1] + ts.t[1:]) / 2.0

        s = []
        for v in ts:
            s = v
            break

        fig, ax = plt.subplots(2, 1, figsize=(8, 6), dpi=80)
        ax[0].hold = True
        ax[1].hold = True
        xmin, xmax = [0.0, 0.0]
        xmin1, xmax1 = [0.0, 0.0]
        dt = numpy.diff(ts.t)
        for v in ts:
            rate = numpy.array(numpy.divide(numpy.diff(v), dt), dtype=numpy.int64)
            d = numpy.linalg.norm(rate, ord=1) / float(len(rate))
            xmin, xmax = [min(xmin, min(rate)), max(xmax, max(rate))]
            xmin1, xmax1 = [min(xmin1, min(rate - d)), max(xmax1, max(rate - d))]
            ax[0].plot(tmid, rate)
            ax[1].plot(tmid, rate - d)

        xmin, xmax = tspl_utils.expand_range(xmin, xmax, 0.1)
        xmin1, xmax1 = tspl_utils.expand_range(xmin1, xmax1, 0.1)

        ax[0].set_ylim(bottom=xmin, top=xmax)
        ax[1].set_ylim(bottom=xmin1, top=xmax1)

        fname = "_".join(["graph", ts.j.id, ts.k1[0], ts.k2[0], "adjust" + full])
        fig.savefig(fname)
        plt.close()
Пример #4
0
def plot_correlation(ts,r,full,output_dir='.'):
  tmid=(ts.t[:-1]+ts.t[1:])/2.0
  fig, ax=plt.subplots(2,2,figsize=(10, 10), dpi=80)
  ax[0][0].hold=True
  ax[0][1].hold=True
  ax[1][0].hold=True
  ax[1][1].clear()

  mx=0.
  my=0.

  for k in ts.data[0].keys():
    for i in range(len(ts.data[0][k])):
      first_rate=numpy.diff(ts.data[0][k][i])/numpy.diff(ts.t)
      second_rate=numpy.diff(ts.data[1][k][i])/numpy.diff(ts.t)
      mx=max(mx,max(first_rate))
      my=max(my,max(second_rate))
      ax[0][0].plot(first_rate,second_rate,'.')
      ax[1][0].plot(first_rate[::-1],tmid[::-1]/3600.)
      ax[0][1].plot(tmid/3600.,second_rate)

  ax[0][0].set_xlabel('Total ' + ts.label(ts.k1[0],ts.k2[0]) + '/s')
  ax[0][0].set_ylabel('Total ' + ts.label(ts.k1[1],ts.k2[1]) + '/s')
  ax[1][0].set_ylabel('Time (hr)')
  ax[1][0].set_xlabel('Total ' + ts.label(ts.k1[0],ts.k2[0]) + '/s')
  ax[0][1].set_xlabel('Time (hr)')
  ax[0][1].set_ylabel('Total ' + ts.label(ts.k1[1],ts.k2[1]) + '/s')

  plt.subplots_adjust(hspace=.25)
  title=ts.title + ', R=%(R)-8.3g' % { 'R' : r}
  plt.suptitle(title)

  xmin,xmax=tspl_utils.expand_range(0.,mx,.1)
  ymin,ymax=tspl_utils.expand_range(0.,my,.1)
  tmin,tmax=tspl_utils.expand_range(0.,tmid[-1]/3600,.1)
  ax[0][0].set_xlim(left=xmin,right=xmax)
  ax[0][0].set_ylim(bottom=ymin,top=ymax)
  ax[1][0].set_xlim(left=xmin,right=xmax)
  ax[1][0].set_ylim(bottom=tmax,top=tmin)
  ax[0][1].set_ylim(bottom=ymin,top=ymax)
  ax[0][1].set_xlim(left=tmin,right=tmax)
  try:
    fname='_'.join(['graph',ts.j.id,ts.j.acct['owner'],
                    ts.k1[0],ts.k2[0],'vs',
                    ts.k1[1],ts.k2[1]])+full
  except:
    fname='_'.join(['graph',ts.j.id,
                    ts.k1[0],ts.k2[0],'vs',
                    ts.k1[1],ts.k2[1]])+full


  fig.savefig(output_dir+'/'+fname)
  plt.close()
Пример #5
0
def heatmap(ts, n, m, full):
    tmid = (ts.t[:-1] + ts.t[1:]) / 2.0
    fig, ax = plt.subplots(1, 1, figsize=(8, 6), dpi=80)
    ymin = 0.  # Wrong in general, but min must be 0. or less
    ymax = 0.
    first = True
    for v in ts:
        rate = numpy.divide(numpy.diff(v), numpy.diff(ts.t))
        if first:
            r = rate
            first = False
        else:
            r = numpy.vstack((r, rate))

        ymin = min(ymin, min(rate))
        ymax = max(ymax, max(rate))
    ymin, ymax = tspl_utils.expand_range(ymin, ymax, 0.1)

    l = r.shape[0]
    y = numpy.arange(l)
    plt.pcolor(tmid / 3600, y, r)
    plt.colorbar()
    plt.clim(ymin, ymax)

    title = ts.title + ', V: %(V)-8.3g' % {'V': m}
    plt.suptitle(title)
    ax.set_xlabel('Time (hr)')
    if n.f:
        ax.set_ylabel('Item')
    else:
        ax.set_ylabel('Host')
    fname = '_'.join(['graph', ts.j.id, ts.k1[0], ts.k2[0], 'heatmap' + full])
    fig.savefig(fname)
    plt.close()
Пример #6
0
def heatmap(ts,n,m,full):
  tmid=(ts.t[:-1]+ts.t[1:])/2.0
  fig,ax=plt.subplots(1,1,figsize=(8,6),dpi=80)
  ymin=0. # Wrong in general, but min must be 0. or less
  ymax=0.
  first=True
  for v in ts:
    rate=numpy.divide(numpy.diff(v),numpy.diff(ts.t))
    if first:
      r=rate
      first=False
    else:
      r=numpy.vstack((r,rate))

    ymin=min(ymin,min(rate))
    ymax=max(ymax,max(rate))
  ymin,ymax=tspl_utils.expand_range(ymin,ymax,0.1)

  l=r.shape[0]
  y=numpy.arange(l)
  plt.pcolor(tmid/3600,y,r)
  plt.colorbar()
  plt.clim(ymin,ymax)
  
  title=ts.title + ', V: %(V)-8.3g' % {'V' : m}
  plt.suptitle(title)
  ax.set_xlabel('Time (hr)')
  if n.f:
    ax.set_ylabel('Item')
  else:
    ax.set_ylabel('Host')
  fname='_'.join(['graph',ts.j.id,ts.k1[0],ts.k2[0],'heatmap'+full])
  fig.savefig(fname)
  plt.close()
Пример #7
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-f', help='Set full mode', action='store_true')
    parser.add_argument('filearg',
                        help='File, directory, or quoted'
                        ' glob pattern',
                        nargs='?',
                        default='jobs')

    n = parser.parse_args()
    filelist = tspl_utils.getfilelist(n.filearg)

    for file in filelist:
        try:
            full = ''
            ts = tspl.TSPLBase(file,
                               ['amd64_sock', 'amd64_sock', 'amd64_sock'],
                               ['HT0', 'HT1', 'HT2'])
        except tspl.TSPLException as e:
            continue

        if not tspl_utils.checkjob(ts, 3600, 16):  # 1 hour, 16way only
            continue
        elif ts.numhosts < 2:  # At least 2 hosts
            print ts.j.id + ': 1 host'
            continue

        print ts.j.id
        tmid = (ts.t[:-1] + ts.t[1:]) / 2.0
        dt = numpy.diff(ts.t)

        fig, ax = plt.subplots(1, 1, figsize=(8, 6), dpi=80)
        ax.hold = True
        xmin, xmax = [0., 0.]
        c = Colors()
        for k in ts.j.hosts.keys():
            h = ts.j.hosts[k]
            col = c.next()
            for i in range(3):
                for j in range(4):
                    rate = numpy.divide(numpy.diff(ts.data[i][k][j]), dt)
                    xmin, xmax = [min(xmin, min(rate)), max(xmax, max(rate))]
                    ax.plot(tmid / 3600, rate, '-' + col)
        if xmax > 2.0e9:
            print ts.j.id + ' over limit: %(v)8.3f' % {'v': xmax}
        else:
            plt.close()
            continue

        plt.suptitle(ts.title)
        xmin, xmax = tspl_utils.expand_range(xmin, xmax, .1)
        ax.set_ylim(bottom=xmin, top=xmax)

        fname = '_'.join(['graph', ts.j.id, 'HT_rates'])
        fig.savefig(fname)
        plt.close()
Пример #8
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('-f', help='Set full mode', action='store_true')
  parser.add_argument('filearg', help='File, directory, or quoted'
                      ' glob pattern', nargs='?',default='jobs')

  n=parser.parse_args()
  filelist=tspl_utils.getfilelist(n.filearg)


  for file in filelist:
    try:
      full=''
      ts=tspl.TSPLBase(file,['amd64_sock', 'amd64_sock', 'amd64_sock'],
                      ['HT0', 'HT1', 'HT2'])
    except tspl.TSPLException as e:
      continue
    
    if not tspl_utils.checkjob(ts,3600,16): # 1 hour, 16way only
      continue
    elif ts.numhosts < 2: # At least 2 hosts
      print ts.j.id + ': 1 host'
      continue

    print ts.j.id
    tmid=(ts.t[:-1]+ts.t[1:])/2.0
    dt=numpy.diff(ts.t)

    fig,ax=plt.subplots(1,1,figsize=(8,6),dpi=80)
    ax.hold=True
    xmin,xmax=[0.,0.]
    c=Colors()
    for k in ts.j.hosts.keys():
      h=ts.j.hosts[k]
      col=c.next()
      for i in range(3):
        for j in range(4):
          rate=numpy.divide(numpy.diff(ts.data[i][k][j]),dt)
          xmin,xmax=[min(xmin,min(rate)),max(xmax,max(rate))]
          ax.plot(tmid/3600,rate,'-'+col)
    if xmax > 2.0e9:
      print ts.j.id + ' over limit: %(v)8.3f' % {'v' : xmax}
    else:
      plt.close()
      continue

    plt.suptitle(ts.title)
    xmin,xmax=tspl_utils.expand_range(xmin,xmax,.1)
    ax.set_ylim(bottom=xmin,top=xmax)

    fname='_'.join(['graph',ts.j.id,'HT_rates'])
    fig.savefig(fname)
    plt.close()
Пример #9
0
def lineplot(ts, n, m, full):
    tmid = (ts.t[:-1] + ts.t[1:]) / 2.0
    fig, ax = plt.subplots(1, 1, figsize=(8, 6), dpi=80)
    ax.hold = True
    ymin = 0.  # Wrong in general, but min must be 0. or less
    ymax = 0.
    for v in ts:
        rate = numpy.divide(numpy.diff(v), numpy.diff(ts.t))
        ymin = min(ymin, min(rate))
        ymax = max(ymax, max(rate))
        ax.plot(tmid / 3600, rate, 'o-')
    ymin, ymax = tspl_utils.expand_range(ymin, ymax, 0.1)
    ax.set_ylim(bottom=ymin, top=ymax)
    title = ts.title + ', V: %(V)-8.3g' % {'V': m}
    plt.suptitle(title)
    ax.set_xlabel('Time (hr)')
    ax.set_ylabel('Total ' + ts.label(ts.k1[0], ts.k2[0]) + '/s')
    fname = '_'.join(['graph', ts.j.id, ts.k1[0], ts.k2[0], 'vs_t' + full])
    fig.savefig(fname)
    plt.close()
Пример #10
0
def lineplot(ts,n,m,full):
  tmid=(ts.t[:-1]+ts.t[1:])/2.0
  fig,ax=plt.subplots(1,1,figsize=(8,6),dpi=80)
  ax.hold=True
  ymin=0. # Wrong in general, but min must be 0. or less
  ymax=0.
  for v in ts:
    rate=numpy.divide(numpy.diff(v),numpy.diff(ts.t))
    ymin=min(ymin,min(rate))
    ymax=max(ymax,max(rate))
    ax.plot(tmid/3600,rate,'o-')
  ymin,ymax=tspl_utils.expand_range(ymin,ymax,0.1)
  ax.set_ylim(bottom=ymin,top=ymax)
  title=ts.title + ', V: %(V)-8.3g' % {'V' : m}
  plt.suptitle(title)
  ax.set_xlabel('Time (hr)')
  ax.set_ylabel('Total ' + ts.label(ts.k1[0],ts.k2[0]) + '/s')
  fname='_'.join(['graph',ts.j.id,ts.k1[0],ts.k2[0],'vs_t'+full])
  fig.savefig(fname)
  plt.close()
Пример #11
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('-f', help='Set full mode', action='store_true')
  parser.add_argument('key1', help='First key', nargs='?',
                      default='amd64_core')
  parser.add_argument('key2', help='Second key', nargs='?',
                      default='SSE_FLOPS')
  parser.add_argument('filearg', help='File, directory, or quoted'
                      ' glob pattern', nargs='?',default='jobs')

  n=parser.parse_args()
  filelist=tspl_utils.getfilelist(n.filearg)

  for file in filelist:
    try:
      if n.f:
        full='_full'
        ts=tspl.TSPLBase(file,[n.key1],[n.key2])
      else:
        full=''
        ts=tspl.TSPLSum(file,[n.key1],[n.key2])
    except tspl.TSPLException as e:
      continue
    
    if not tspl_utils.checkjob(ts,3600,16): # 1 hour, 16way only
      continue
    elif ts.numhosts < 2: # At least 2 hosts
      print ts.j.id + ': 1 host'
      continue

    print ts.j.id

    tmid=(ts.t[:-1]+ts.t[1:])/2.0

    s=[]
    for v in ts:
      s=v
      break

    fig,ax=plt.subplots(2,1,figsize=(8,6),dpi=80)
    ax[0].hold=True
    ax[1].hold=True
    xmin,xmax=[0.,0.]
    xmin1,xmax1=[0.,0.]
    dt=numpy.diff(ts.t)
    for v in ts:
      rate=numpy.array(numpy.divide(numpy.diff(v),dt),dtype=numpy.int64)
      d=numpy.linalg.norm(rate,ord=1)/float(len(rate))
      xmin,xmax=[min(xmin,min(rate)),max(xmax,max(rate))]
      xmin1,xmax1=[min(xmin1,min(rate-d)),max(xmax1,max(rate-d))]
      ax[0].plot(tmid,rate)
      ax[1].plot(tmid,rate-d)

    xmin,xmax=tspl_utils.expand_range(xmin,xmax,.1)
    xmin1,xmax1=tspl_utils.expand_range(xmin1,xmax1,.1)

    ax[0].set_ylim(bottom=xmin,top=xmax)
    ax[1].set_ylim(bottom=xmin1,top=xmax1)

    fname='_'.join(['graph',ts.j.id,ts.k1[0],ts.k2[0],'adjust'+full])
    fig.savefig(fname)
    plt.close()