コード例 #1
0
ファイル: GUI_app.py プロジェクト: Alez87/process_monitoring
def main():
    if len(sys.argv) <= 1:
        print "Specify a process to monitor"
        sys.exit(1)
    process = sys.argv[1]
    pid = get_pid(process)
    if pid == "":
        print "No PID found"
        sys.exit(1)
    print "Process: %s" % process
    print "Pid: %s" % pid
    print 'NO.    CPU    MEMORY    DISK    I/O'
    matplotlib.rcParams['toolbar'] = 'None'
    plt.figure(figsize=(20, 10))
    i = 0
    while True:
        i += 1
        plt.ylim(0, 100)
        plt.xlim(0, N)
        _cpu = data.cpu(pid, process)
        _mem = data.mem(pid, process)
        _disk = data.disk()
        _io = data.io()
        print i, '\t', _cpu, '\t', _mem, '\t', _disk, '\t', _io
        cpu.append(_cpu)
        mem.append(_mem)
        #disk.append(_disk)
        #io.append(_io)
        plt.grid(True)
        plt.xlabel('TIME IN S')
        plt.ylabel('USAGE IN %')
        plt.title(' - - SYSTEM MONITOR - - ')
        cpu_label = 'CPU (' + _cpu + '%)'
        mem_label = 'MEM (' + _mem + '%)'
        disk_label = 'DISK (' + _disk + 'KB/S)'
        io_label = 'IO (' + _io + 'KB/S)'
        plt.plot(cpu[-60:-1], 'g', label=cpu_label)
        plt.plot(mem[-60:-1], 'r', label=mem_label)
        plt.plot(disk[-60:-1], 'k', label=disk_label)
        plt.plot(io[-60:-1], 'b', label=io_label)
        plt.legend(loc='upper center',
                   bbox_to_anchor=(0.5, -0.06, 0, 0.04),
                   ncol=5)
        if len(cpu) > N:
            del cpu[0]
            del mem[0]

#del disk[0]
#del io[0]
        plt.draw()
        matplotlib.interactive(True)
        plt.show()
        plt.clf()
コード例 #2
0
def main():
    if len(sys.argv) <= 1:
	print "Specify a process to monitor"
	sys.exit(1)
    process=sys.argv[1]
    pid=get_pid(process)
    if pid == "":
	print "No PID found"
	sys.exit(1)
    print "Process: %s"%process
    print "Pid: %s"%pid
    print 'NO.    CPU    MEMORY    DISK    I/O'
    matplotlib.rcParams['toolbar'] = 'None'
    plt.figure(figsize=(20,10))
    i=0
    while True:
        i+=1
        plt.ylim(0,100)
        plt.xlim(0,N)
        _cpu=data.cpu(pid,process)
        _mem=data.mem(pid, process)
        _disk=data.disk()
	_io=data.io()
        print i,'\t',_cpu,'\t',_mem,'\t',_disk,'\t',_io
        cpu.append(_cpu)
        mem.append(_mem)
        #disk.append(_disk)
	#io.append(_io)
        plt.grid(True)
        plt.xlabel('TIME IN S')
        plt.ylabel('USAGE IN %')
        plt.title(' - - SYSTEM MONITOR - - ')
        cpu_label='CPU ('+_cpu+'%)'
	mem_label='MEM ('+_mem+'%)'
	disk_label='DISK ('+_disk+'KB/S)'
	io_label='IO ('+_io+'KB/S)'
        plt.plot(cpu[-60:-1],'g', label=cpu_label)
        plt.plot(mem[-60:-1],'r', label=mem_label)
	plt.plot(disk[-60:-1],'k', label=disk_label)
	plt.plot(io[-60:-1],'b', label=io_label)
	plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.06,0,0.04), ncol=5)
	if len(cpu)>N:
            del cpu[0]
	    del mem[0]
	    #del disk[0]
	    #del io[0]
        plt.draw()
        matplotlib.interactive(True)
	plt.show()
        plt.clf()
コード例 #3
0
ファイル: tomobox.py プロジェクト: teascavenger/tomobox2
    def __init__(self, block_sizeGB=1, swap=False, pool_dtype='float32'):

        # Default RAM based data array:
        self.data = data_array(dtype='float32',
                               block_sizeGB=block_sizeGB,
                               swap=swap,
                               pool_dtype=pool_dtype)

        # Common classes for the cvolume and for the projections:
        self.io = io(self)
        self.display = display(self)
        self.analyse = analyse(self)

        # Specific to the projection data or the volume data:
        self.process = None
        self.meta = None
コード例 #4
0
def main():
    if len(sys.argv) <= 1:
        print "Specify a process to monitor"
        sys.exit(1)
    process = sys.argv[1]
    pid = get_pid(process)
    if pid == "":
        print "No PID found"
        sys.exit(1)
    print "Process: %s" % process
    print "Pid: %s" % pid
    while True:
        _cpu = data.cpu(pid, process)
        _mem = data.mem(pid, process)
        _disk = data.disk()
        _io = data.io()
        print "CPU (", _cpu, "%) - MEM (", _mem, "%) - DISK (", _disk, "KB/S) - IO (", _io, "KB/S)"
コード例 #5
0
def main():
    if len(sys.argv) <= 1:
        print "Specify a process to monitor"
        sys.exit(1)
    process = sys.argv[1]
    pid = get_pid(process)
    if pid == "":
        print "No PID found"
        sys.exit(1)
    print "Process: %s" % process
    print "Pid: %s" % pid
    while True:
        _cpu = data.cpu(pid, process)
        _mem = data.mem(pid, process)
        _disk = data.disk()
        _io = data.io()
        print 'CPU (', _cpu, '%) - MEM (', _mem, '%) - DISK (', _disk, 'KB/S) - IO (', _io, 'KB/S)'