def __init__(self, plot, depth, reader, cpu): self.__curveCpuHist__ = plotobjects.niceCurve("CPU History", 1 , QtGui.QColor(0,255,0),QtGui.QColor(0,170,0), plot) self.__curveCpuSystemHist__ = plotobjects.niceCurve("CPU Kernel History", 1, QtGui.QColor(255,0,0),QtGui.QColor(170,0,0), plot) self.__curveIoWaitHist__ = plotobjects.niceCurve("CPU IO wait history", 1, QtGui.QColor(0,0,255),QtGui.QColor(0,0,127), plot) self.__curveIrqHist__ = plotobjects.niceCurve("CPU irq history", 1, QtGui.QColor(0,255,255),QtGui.QColor(0,127,127), plot) scale = plotobjects.scaleObject() scale.min = 0 scale.max = 100 self.__adaptedplot__ = plotobjects.procExpPlot(plot, scale) self.__plot__ = plot self.__depth__ = depth self.__reader__ = reader self.__cpu__ = cpu self.__cpuUsageHistory__ = [0] * int(self.__depth__) self.__cpuUsageSystemHistory__ = [0] * int(self.__depth__) self.__cpuUsageIoWaitHistory__ = [0] * int(self.__depth__) self.__cpuUsageIrqHistory__ = [0] * int(self.__depth__)
def update(self, values): if self.__first__ == False: self.__first__ = True scale = plotobjects.scaleObject() scale.min = 0 scale.max = values[0] self.__adaptedmemoryplot = plotobjects.procExpPlot(self.__plot__, scale) self.__memoryUsageHistory__.append(values[0]-values[1]) self.__memoryUsageHistory__ = self.__memoryUsageHistory__[1:] self.__curveMemHist__.setData(range(self.__depth__), self.__memoryUsageHistory__) self.__plot__.replot()
def prepareUI(mainUi): """ prepare the main UI, setup plots and menu triggers """ global g_timer mainUi.processTreeWidget.setColumnCount(len(g_treeViewcolumns)) mainUi.processTreeWidget.setHeaderLabels(g_treeViewcolumns) mainUi.processTreeWidget.header().setContextMenuPolicy(QtCore.Qt.CustomContextMenu) mainUi.processTreeWidget.header().customContextMenuRequested.connect(onHeaderContextMenu) #create a timer which triggers the process explorer to update its contents g_timer = QtCore.QTimer(mainUi.processTreeWidget) QtCore.QObject.connect(g_timer, QtCore.SIGNAL("timeout()"), updateUI) QtCore.QObject.connect(mainUi.processTreeWidget, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), onContextMenu) QtCore.QObject.connect(mainUi.menuFile, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuProcess, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuOptions, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuSettings, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuView, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuHelp, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) #prepare the plot global g_curveCpuHist global g_curveCpuSystemHist global g_curveIoWaitHist global g_curveIrqHist global g_curveCpuPlotGrid g_curveCpuHist = plotobjects.niceCurve("CPU History", 1 , QtGui.QColor(0,255,0),QtGui.QColor(0,170,0), mainUi.qwtPlotOverallCpuHist) g_curveCpuSystemHist = plotobjects.niceCurve("CPU Kernel History", 1, QtGui.QColor(255,0,0),QtGui.QColor(170,0,0), mainUi.qwtPlotOverallCpuHist) g_curveIoWaitHist = plotobjects.niceCurve("CPU IO wait history", 1, QtGui.QColor(0,0,255),QtGui.QColor(0,0,127), mainUi.qwtPlotOverallCpuHist) g_curveIrqHist = plotobjects.niceCurve("CPU irq history", 1, QtGui.QColor(0,255,255),QtGui.QColor(0,127,127), mainUi.qwtPlotOverallCpuHist) scale = plotobjects.scaleObject() scale.min = 0 scale.max = 100 _ = plotobjects.procExpPlot(mainUi.qwtPlotOverallCpuHist, scale, hasGrid=False)
def __init__(self, plot, depth, reader, card, scale): self.__curveNetInHist__ = plotobjects.niceCurve("Network In History", 1 ,QtGui.QColor(241,254,1), QtGui.QColor(181,190,1), plot) self.__curveNetOutHist__ = plotobjects.niceCurve("Network Out History", 1, QtGui.QColor(28,255,255),QtGui.QColor(0,168,168), plot) self.__depth__ = depth self.__reader__ = reader self.__first__ = False self.__plot__ = plot self.__card__ = card #adapt the network plot self.__adaptednetworkplot = plotobjects.procExpPlot(self.__plot__, scale) self.__networkInUsageHistory__ = [0] * int(self.__depth__) self.__networkOutUsageHistory__ = [0] * int(self.__depth__)
def __init__(self, plot, depth, reader, card, scale): self.__curveNetInHist__ = plotobjects.niceCurve( "Network In History", 1, QtGui.QColor(241, 254, 1), QtGui.QColor(181, 190, 1), plot) self.__curveNetOutHist__ = plotobjects.niceCurve( "Network Out History", 1, QtGui.QColor(28, 255, 255), QtGui.QColor(0, 168, 168), plot) self.__depth__ = depth self.__reader__ = reader self.__first__ = False self.__plot__ = plot self.__card__ = card #adapt the network plot self.__adaptednetworkplot = plotobjects.procExpPlot( self.__plot__, scale) self.__networkInUsageHistory__ = [0] * int(self.__depth__) self.__networkOutUsageHistory__ = [0] * int(self.__depth__)
def prepareUI(mainUi): global timer mainUi.processTreeWidget.setColumnCount(len(treeViewcolumns)) mainUi.processTreeWidget.setHeaderLabels(treeViewcolumns) mainUi.processTreeWidget.header().setContextMenuPolicy( QtCore.Qt.CustomContextMenu) mainUi.processTreeWidget.header().customContextMenuRequested.connect( onHeaderContextMenu) #create a timer timer = QtCore.QTimer(mainUi.processTreeWidget) QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"), updateUI) QtCore.QObject.connect( mainUi.processTreeWidget, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), onContextMenu) QtCore.QObject.connect(mainUi.menuFile, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuProcess, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuOptions, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuSettings, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuView, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) QtCore.QObject.connect(mainUi.menuHelp, QtCore.SIGNAL('triggered(QAction*)'), performMenuAction) #prepare the plot global curveCpuHist global curveCpuSystemHist global curveIoWaitHist global curveIrqHist global curveCpuPlotGrid curveCpuHist = plotobjects.niceCurve("CPU History", 1, QtGui.QColor(0, 255, 0), QtGui.QColor(0, 170, 0), mainUi.qwtPlotOverallCpuHist) curveCpuSystemHist = plotobjects.niceCurve("CPU Kernel History", 1, QtGui.QColor(255, 0, 0), QtGui.QColor(170, 0, 0), mainUi.qwtPlotOverallCpuHist) curveIoWaitHist = plotobjects.niceCurve("CPU IO wait history", 1, QtGui.QColor(0, 0, 255), QtGui.QColor(0, 0, 127), mainUi.qwtPlotOverallCpuHist) curveIrqHist = plotobjects.niceCurve("CPU irq history", 1, QtGui.QColor(0, 255, 255), QtGui.QColor(0, 127, 127), mainUi.qwtPlotOverallCpuHist) scale = plotobjects.scaleObject() scale.min = 0 scale.max = 100 _ = plotobjects.procExpPlot(mainUi.qwtPlotOverallCpuHist, scale, hasGrid=False)