|
|
|
@ -214,9 +214,8 @@ with open("/proc/cpuinfo") as f: |
|
|
|
cpu_name = line.replace("\n", "").split(": ")[1] |
|
|
|
cpu_name = line.replace("\n", "").split(": ")[1] |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
f = open("data.txt", "w") |
|
|
|
with open("data.txt", "w") as f: |
|
|
|
f.write("# pid: %d, machine: %s, cpu count: %d\n" % (os.getpid(), uname, cpus)) |
|
|
|
f.write("# pid: %d, machine: %s, cpu count: %d\n" % (os.getpid(), uname, cpus)) |
|
|
|
f.close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p.stdout.readline() |
|
|
|
p.stdout.readline() |
|
|
|
|
|
|
|
|
|
|
|
@ -266,9 +265,8 @@ while 1: |
|
|
|
die = 1 |
|
|
|
die = 1 |
|
|
|
break |
|
|
|
break |
|
|
|
labels.append(["%04d-%02d-%02d-%02d:%02d:%02d" % (now.year, now.month, now.day, now.hour, now.minute, now.second), label_line]) |
|
|
|
labels.append(["%04d-%02d-%02d-%02d:%02d:%02d" % (now.year, now.month, now.day, now.hour, now.minute, now.second), label_line]) |
|
|
|
f = open("data.txt", "a") |
|
|
|
with open("data.txt", "a") as f: |
|
|
|
f.write("# %04d-%02d-%02d-%02d:%02d:%02d label: %s\n" % (now.year, now.month, now.day, now.hour, now.minute, now.second, label_line)) |
|
|
|
f.write("# %04d-%02d-%02d-%02d:%02d:%02d label: %s\n" % (now.year, now.month, now.day, now.hour, now.minute, now.second, label_line)) |
|
|
|
f.close() |
|
|
|
|
|
|
|
if (p.stdout not in rlist): |
|
|
|
if (p.stdout not in rlist): |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
@ -293,9 +291,8 @@ while 1: |
|
|
|
TOTAL_RAM = (int(values['kbmemused'][0]) + int(values['kbmemfree'][0])) / 1024.0 / 1024.0 |
|
|
|
TOTAL_RAM = (int(values['kbmemused'][0]) + int(values['kbmemfree'][0])) / 1024.0 / 1024.0 |
|
|
|
if MAX_USED_RAM < int(values['kbmemused'][0]): |
|
|
|
if MAX_USED_RAM < int(values['kbmemused'][0]): |
|
|
|
MAX_USED_RAM = int(values['kbmemused'][0]) |
|
|
|
MAX_USED_RAM = int(values['kbmemused'][0]) |
|
|
|
f = open("data.txt", "a") |
|
|
|
with open("data.txt", "a") as f: |
|
|
|
f.write("%s %s %s\n" % (values["time"][0], values["%user"][0], values["%memused"][0])) |
|
|
|
f.write("%s %s %s\n" % (values["time"][0], values["%user"][0], values["%memused"][0])) |
|
|
|
f.close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if die: |
|
|
|
if die: |
|
|
|
break |
|
|
|
break |
|
|
|
@ -317,9 +314,8 @@ sdt = datetime.strptime(START_DATE, '%Y-%m-%d %H:%M:%S') |
|
|
|
edt = datetime.strptime(END_DATE, '%Y-%m-%d %H:%M:%S') |
|
|
|
edt = datetime.strptime(END_DATE, '%Y-%m-%d %H:%M:%S') |
|
|
|
delta_t = ((edt - sdt).total_seconds()) / 60.0 |
|
|
|
delta_t = ((edt - sdt).total_seconds()) / 60.0 |
|
|
|
|
|
|
|
|
|
|
|
f = open("data.txt", "a") |
|
|
|
with open("data.txt", "a") as f: |
|
|
|
f.write("# total ram: %.2f GB, max ram used: %.2f GB, avarage load: %.2f %%, duration: %.2f minutes\n" % (TOTAL_RAM, MAX_USED_RAM, AVERAGE_LOAD, delta_t)) |
|
|
|
f.write("# total ram: %.2f GB, max ram used: %.2f GB, avarage load: %.2f %%, duration: %.2f minutes\n" % (TOTAL_RAM, MAX_USED_RAM, AVERAGE_LOAD, delta_t)) |
|
|
|
f.close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g("set title 'cpu load (avarage = %.2f %%)'" % AVERAGE_LOAD) |
|
|
|
g("set title 'cpu load (avarage = %.2f %%)'" % AVERAGE_LOAD) |
|
|
|
g("set title tc rgb 'white' font 'Courier-New,8'") |
|
|
|
g("set title tc rgb 'white' font 'Courier-New,8'") |
|
|
|
|