Beispiel #1
0
#!/usr/bin/python

from core.datastore import Datastore
from core.seriesprofile import SeriesProfile
from core.axis import Axis
from input.fileread import FileRead
from gui import Gui
import subprocess

if __name__ == "__main__":
    datastore = Datastore()
    
    process = subprocess.Popen(["vmstat", "-n", "1"], stdout=subprocess.PIPE)
    
    f = FileRead(datastore, process.stdout, skiplines=1, readheader=True)
    f.start()
    
    gui = Gui(datastore, {
                    "free": SeriesProfile(line=3),
                    "buff": SeriesProfile(line=3, color="ffff80"),
                    "cache": SeriesProfile(line=3, color="ff80ff")
                     })
    gui.getMainPlotWidget().setXAxis(Axis(0, 600, wrap=True))
    gui.getMainPlotWidget().setYAxis(Axis(0, 3000000))
    gui.run()
    
    f.stop()
    f.join()

Beispiel #2
0
    (options, args) = parser.parse_args()

    # Start doing stuff

    datastore = Datastore()
    
    infile = sys.stdin
    if len(args) > 0:
        infile = open(args[0])
    
    f = FileRead(datastore, infile, skiplines=0, readheader=False, separator=options.separator)
    f.start()
    
    (min, max) = options.x_axis.split(":")
    xAxis = Axis(float(min), float(max))
    (min, max) = options.y_axis.split(":")
    yAxis = Axis(float(min), float(max))
    
    if options.wrap:
        xAxis.wrap = True
    
    series = parseSeries(options.series)
    
    gui = Gui(datastore, series)
    gui.getMainPlotWidget().setXAxis(xAxis)
    gui.getMainPlotWidget().setYAxis(yAxis)
    gui.run()
    
    f.stop()
    f.join()