Ejemplo n.º 1
0
def do_action(args, pair):
    """
    I need to generate appropriate content here.
    """
    (x, y) = pair
    fig = plt.figure()
    ax = fig.add_subplot(111)
    Graph.scatter(ax, x, y, 'b', label="just a dumb scatter plot")
    plt.xlabel('x')
    plt.ylabel(r'y')
    plt.title('x versus y')
    if args.plot == None:
        plt.show()
    else:
        plt.savefig(args.plot)
Ejemplo n.º 2
0
Archivo: mds.py Proyecto: dani-lbnl/lmt
def do_xcorr(mds, plot=None, ybound=None, hilite="open"):
    if mds.CPU is None:
        print "mds.do_xcorr(): Error - There is no CPU utilization data for %s" % mds.name
        return
    if mds.MDS is None:
        print "mds.do_xcorr(): Error - There is no data for %s" % mds.name
        return
    if ybound is None:
        ybound = mds.MDS.getMax()
    fig = plt.figure()
    ax = fig.add_subplot(111)
    Graph.scatter(ax, mds.CPU.Values, mds.MDS.Values, 'b', label="mds ops")
    if not hilite is None:
        n = 0
        op_index = None
        for op in mds.Ops:
            #print "mds.do_xcorr(): Debug - op name = %s, hilite = %s" % (op.name, hilite)
            if ((op.Values is None) or (op.Steps is None) or
                (op.Steps.steps() == 0) or (op.Stats is None)):
                continue
            if op.name == hilite:
                op_index = n
            n += 1
        if n > 0:
            # mds.x is teh result of a generalized linear regression apporioning
            # the fraction of CPU utilization to each operation. x[n] is the
            # final category, of "no operation".
            if mds.x is None:
                mds.attribute()
            if (not op_index is None) and (mds.x[op_index] != 0.0):
                slope = (100 - mds.x[n])/(100*mds.x[op_index])
                model_x = np.array(range(101))
                model_y = mds.x[n]/100.0 + slope*model_x
                #print "hilite = %s, op_index = %d, y(0) = %f, y(1) = %f" % (hilite, op_index, model_y[0], model_y[99])
                ax.plot(model_x, model_y, "r-", label=hilite)
        else:
            print "mds.do_xcorr(): Warning - No ops with data for regression"
    ax.set_xbound(lower = 0, upper = 100)
    ax.set_ybound(lower = 0, upper = ybound)
    ax.legend()
    plt.title("%s activity vs %%CPU" % mds.name)
    ax.set_xlabel(r"$\%$ CPU")
    ax.set_ylabel(r"$ops/sec$")
    if plot is None:
        plt.show()
    else:
        plt.savefig(plot)
    plt.cla()
Ejemplo n.º 3
0
def do_xcorr(B, mode=None, plot=None, ybound=None, scale=1024*1024):
    """
    The scatter plot of the aggregate I/O rates versus average CPU utilization
    is less illumination than the composite of all the individual OSS scatter
    plots. I don't call on this one, but it is still here and available.
    """
    if not ((mode == 'Read') or (mode == 'Write') or (mode == 'Both') or (mode is None)):
        print "bulk.do_xcorr: Error - Unrecognized mode %s" % mode
        return
    if B.CPU is None:
        print "bulk.do_xcorr(): Error - There is no CPU utilization data for %s" % B.name
        return
    if ((B.Read is None) or (B.Write is None) or (B.bulk is None)):
        print "bulk.do_xcorr(): Error - There is no data"
        return(None)
    if ybound is None:
        if mode == 'Read':
            ymax = B.Read.getMax()/scale
        elif mode == 'Write':
            ymax = B.Write.getMax()/scale
        elif mode == 'Both':
            ymax = B.bulk.getMax()/scale
        else:
            readMax = B.Read.getMax()/scale
            writeMax = B.Write.getMax()/scale
            if readMax > writeMax:
                ymax = readMax
            else:
                ymax = writeMax
        ybound = ymax
    fig = plt.figure()
    ax = fig.add_subplot(111)
    if (mode is None) or (mode == 'Read'):
        Graph.scatter(ax, B.CPU.Values, B.Read.Values/scale, 'r', label="read")
    if (mode is None) or (mode == 'Write'):
        Graph.scatter(ax, B.CPU.Values, B.Write.Values/scale, 'b', label="write")
    if mode == 'Both':
        Graph.scatter(ax, B.CPU.Values, B.bulk.Values/scale, 'b', label="read+write")
    ax.set_xbound(lower = 0, upper = 100)
    ax.set_ybound(lower = 0, upper = ybound)
    ax.legend()
    dayStr = time.strftime("%Y-%m-%d", time.localtime(B.begin.sie))
    plt.title("%s bulk %s activity vs %%CPU" % (dayStr, B.name))
    ax.set_xlabel(r"$\%$ CPU")
    ax.set_ylabel(r"$MB/sec$")
    if plot is None:
        plt.show()
    else:
        plt.savefig(plot)
Ejemplo n.º 4
0
def do_composite_xcorr(B, mode=None, plot=None, ybound=None, scale=1024.0*1024.0):
    if ybound is None:
        ymax = 0.0
        for oss in B.OSSs:
            if mode == 'Read':
                ossMax = oss.Read.getMax()/scale
            elif mode == 'Write':
                ossMax = oss.Write.getMax()/scale
            elif mode == 'Both':
                ossMax = oss.OSS.getMax()/scale
            else:
                readMax = oss.Read.getMax()/scale
                writeMax = oss.Write.getMax()/scale
                if readMax > writeMax:
                    ossMax = readMax
                else:
                    ossMax = writeMax
            if ossMax > ymax:
                ymax = ossMax
        ybound = ymax
    if ybound <= 0.0:
        print "bulk.do_composite_xcorr(): Warning - Failed to determine y-scale"
        return
    fig = plt.figure()
    ax = fig.add_subplot(111)
    handles = None
    labels = None
    for oss in B.OSSs:
        if (mode is None) or (mode == 'Read'):
            Graph.scatter(ax, oss.CPU.Values, oss.Read.Values/scale, 'r', label='read')
        if (mode is None) or (mode == 'Write'):
            Graph.scatter(ax, oss.CPU.Values, oss.Write.Values/scale, 'b', label='write')
        if mode == 'Both':
            Graph.scatter(ax, oss.CPU.Values, oss.OSS.Values/scale, 'b', label='read+write')
        if (handles is None) and (labels is None):
            (handles, labels) = ax.get_legend_handles_labels()
    plt.legend(handles, labels)
    ax.set_xbound(lower = 0, upper = 100)
    ax.set_ybound(lower = 0, upper = ybound)
    dayStr = time.strftime("%Y-%m-%d", time.localtime(B.begin.sie))
    plt.title("%s Composite %s OSS activity vs %%CPU" % (dayStr, B.name))
    ax.set_xlabel(r"$\%$ CPU")
    ax.set_ylabel(r"$MB/sec$")
    if plot is None:
        plt.show()
    else:
        plt.savefig(plot)
Ejemplo n.º 5
0
def do_xcorr(bulk, mode, plot, ymax=None, scale=1024*1024):
    """
    """
    if not ((mode == 'Read') or (mode == 'Write') or (mode == 'Both') or (mode == None)):
        print "bulk_quick.do_xcorr: Error - Unrecognized mode %s" % mode
        return
    if bulk.CPU == None:
        print "bulk_quick.do_xcorr(): Error - There is no CPU utilization data for %s" % bulk.name
        return
    if ((bulk.Read == None) or (bulk.Write == None) or (bulk.Bulk == None)):
        print "bulk_quick.do_xcorr(): Error - There is no data"
        return(None)
    if ymax == None:
        if mode == 'Read':
            ymax = bulk.Read.getMax()/scale
        elif mode == 'Write':
            ymax = bulk.Write.getMax()/scale
        elif mode == 'Both':
            ymax = bulk.Bulk.getMax()/scale
        else:
            readMax = bulk.Read.getMax()/scale
            writeMax = bulk.Write.getMax()/scale
            if readMax > writeMax:
                ymax = readMax
            else:
                ymax = writeMax
    fig = plt.figure()
    ax = fig.add_subplot(111)
    if (mode == None) or (mode == 'Read'):
        Graph.scatter(ax, bulk.CPU.Values, bulk.Read.Values/scale, 'r', label="read")
    if (mode == None) or (mode == 'Write'):
        Graph.scatter(ax, bulk.CPU.Values, bulk.Write.Values/scale, 'b', label="write")
    if mode == 'Both':
        Graph.scatter(ax, bulk.CPU.Values, bulk.Bulk.Values/scale, 'b', label="read+write")
    ax.set_xbound(lower = 0, upper = 100)
    ax.set_ybound(lower = 0, upper = ymax)
    ax.legend()
    dayStr = time.strftime("%Y-%m-%d", time.localtime(bulk.begin.sie))
    plt.title("%s Bulk %s activity vs \%CPU" % (dayStr, bulk.name))
    ax.set_xlabel(r"$\%$ CPU")
    ax.set_ylabel(r"$MB/sec$")
    if plot == None:
        plt.show()
    else:
        plt.savefig(plot)
Ejemplo n.º 6
0
Archivo: oss.py Proyecto: dani-lbnl/lmt
def do_xcorr(oss, mode=None, plot=None, ybound=None, scale=1024.0*1024.0):
    if not ((mode == 'Read') or (mode == 'Write') or (mode == 'Both') or (mode is None)):
        print "oss.do_xcorr: Error - Unrecognized mode %s" % mode
        return
    if oss.CPU is None:
        print "oss.do_xcorr(): Error - There is no CPU utilization data for %s" % oss.name
        return
    if ((oss.Read is None) or (oss.Write is None) or (oss.OSS is None)):
        print "oss.do_xcorr(): Error - There is no data"
        return(None)
    if ybound is None:
        if mode == 'Read':
            ymax = oss.Read.getMax()/scale
        elif mode == 'Write':
            ymax = oss.Write.getMax()/scale
        elif mode == 'Both':
            ymax = oss.OSS.getMax()/scale
        else:
            readMax = oss.Read.getMax()/scale
            writeMax = oss.Write.getMax()/scale
            if readMax > writeMax:
                ymax = readMax
            else:
                ymax = writeMax
        ybound = ymax
    fig = plt.figure()
    ax = fig.add_subplot(111)
    if (mode is None) or (mode == 'Read'):
        Graph.scatter(ax, oss.CPU.Values, oss.Read.Values/scale, 'r', label="read")
    if (mode is None) or (mode == 'Write'):
        Graph.scatter(ax, oss.CPU.Values, oss.Write.Values/scale, 'b', label="write")
    if mode == 'Both':
        Graph.scatter(ax, oss.CPU.Values, oss.OSS.Values/scale, 'b', label="read+write")
    ax.set_xbound(lower = 0, upper = 100)
    ax.set_ybound(lower = 0, upper = ybound)
    ax.legend()
    dayStr = time.strftime("%Y-%m-%d", time.localtime(oss.begin.sie))
    plt.title("%s OSS %s activity vs %%CPU" % (dayStr, oss.name))
    ax.set_xlabel(r"$\%$ CPU")
    ax.set_ylabel(r"$MB/sec$")
    if plot is None:
        plt.show()
    else:
        plt.savefig(plot)