diff --git a/common.py b/common.py index 348a90f..0ce2857 100644 --- a/common.py +++ b/common.py @@ -19,7 +19,7 @@ SARGRAPH_VERSION = "2.2.1" # Define units for use with unit_str TIME_UNITS = ['seconds', 'minutes', 'hours'] DATA_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'] - +SPEED_UNITS = ['Mb/s', 'Gb/s', 'Tb/s', 'Pb/s'] # Print an error message and exit with non-zero status def fail(msg): diff --git a/graph.py b/graph.py index ca35a3f..972e46e 100644 --- a/graph.py +++ b/graph.py @@ -207,8 +207,8 @@ def read_comments(session): TOTAL_FS = unit_str(TOTAL_FS, DATA_UNITS) MAX_USED_FS = unit_str(MAX_USED_FS, DATA_UNITS) - MAX_RX = unit_str(MAX_RX, DATA_UNITS) - MAX_TX = unit_str(MAX_TX, DATA_UNITS) + MAX_RX = unit_str(MAX_RX, SPEED_UNITS) + MAX_TX = unit_str(MAX_TX, SPEED_UNITS) DURATION = unit_str(DURATION, TIME_UNITS, 60) @@ -346,9 +346,9 @@ def graph(session, fname='plot'): # Set scale for plots displayed in absolute units - plot(f"{NAME_IFACE} received (B/s)", f"{NAME_IFACE} data received (max = {MAX_RX}/s)", + plot(f"{NAME_IFACE} received (Mb/s)", f"{NAME_IFACE} data received (max = {MAX_RX})", session, 5, space=space, autoscale=1.2) - plot(f"{NAME_IFACE} sent (B/s)", f"{NAME_IFACE} data sent (max = {MAX_TX}/s)", + plot(f"{NAME_IFACE} sent (Mb/s)", f"{NAME_IFACE} data sent (max = {MAX_TX})", session, 6, space=space, autoscale=1.2) g("unset multiplot") diff --git a/watch.py b/watch.py index 25a00b7..b74675e 100644 --- a/watch.py +++ b/watch.py @@ -114,8 +114,8 @@ def summarize(session): total_ram = TOTAL_RAM * 1024.0 max_used_fs = MAX_USED_FS * 1024.0 * 1024.0 total_fs = TOTAL_FS * 1024 * 1024 - max_tx = MAX_TX * 1024 - max_rx = MAX_RX * 1024 + max_tx = MAX_TX / 128 # kB/s to Mb/s + max_rx = MAX_RX / 128 # kB/s to Mb/s sdt = datetime.datetime.strptime(START_DATE, '%Y-%m-%d %H:%M:%S') edt = datetime.datetime.strptime(END_DATE, '%Y-%m-%d %H:%M:%S') @@ -128,8 +128,8 @@ def summarize(session): f"max disk used: {max_used_fs:.2f} B", f"average load: {average_load:.2f} %", f"observed disk: {FS_NAME}", - f"max data received: {max_rx:.2f} B", - f"max data sent: {max_tx:.2f} B", + f"max data received: {max_rx:.2f} Mb/s", + f"max data sent: {max_tx:.2f} Mb/s", f"observed network: {IFACE_NAME}", f"duration: {delta_t} seconds", sep=", ", file=f) @@ -277,8 +277,8 @@ def watch(session, fsdev, iface): cpu_data['%user'][0], ram_data['%memused'][0], fs_data['%fsused'][FS_SAR_INDEX], - stof(net_data['rxkB/s'][IFACE_SAR_INDEX])*1024, - stof(net_data['txkB/s'][IFACE_SAR_INDEX])*1024, + stof(net_data['rxkB/s'][IFACE_SAR_INDEX])/128, # kB/s to Mb/s + stof(net_data['txkB/s'][IFACE_SAR_INDEX])/128, # kB/s to Mb/s file=f) if die: