diff options
author | Determinant <[email protected]> | 2018-09-07 21:50:19 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-09-07 21:50:19 -0400 |
commit | 82d041d9f7881fa23e2999dad636eedaa20217a5 (patch) | |
tree | 333d9ec9a6a8c5ba4be6ad3908d192983115f697 /scripts | |
parent | 05f2c56b909a2cd05a200ad663001696e4a23261 (diff) |
create new branch alt-cli
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/run_client.sh | 2 | ||||
-rw-r--r-- | scripts/thr_hist.py | 24 |
2 files changed, 22 insertions, 4 deletions
diff --git a/scripts/run_client.sh b/scripts/run_client.sh index 92d3add..9e7d1db 100755 --- a/scripts/run_client.sh +++ b/scripts/run_client.sh @@ -194,7 +194,7 @@ function start_all { local ip="$(get_ip_by_id $rid)" local pport="$(get_peer_port_by_id $rid)" local cport="$(get_client_port_by_id $rid)" - local rworkdir="$remote_base/$workdir/${i}" + local rworkdir="$remote_base/$workdir/${j}" ( echo "Starting a client @ $cip, connecting to server #$rid @ $ip:$cport" _remote_load "$workdir" "$rworkdir" "$cip" diff --git a/scripts/thr_hist.py b/scripts/thr_hist.py index c5f2a72..b6ef40a 100644 --- a/scripts/thr_hist.py +++ b/scripts/thr_hist.py @@ -1,8 +1,24 @@ import sys import re import argparse +import numpy as np from datetime import datetime, timedelta +def remove_outliers(x, outlierConstant = 1.5): + a = np.array(x) + upper_quartile = np.percentile(a, 75) + lower_quartile = np.percentile(a, 25) + IQR = (upper_quartile - lower_quartile) * outlierConstant + quartileSet = (lower_quartile - IQR, upper_quartile + IQR) + resultList = [] + removedList = [] + for y in a.tolist(): + if y >= quartileSet[0] and y <= quartileSet[1]: + resultList.append(y) + else: + removedList.append(y) + return (resultList, removedList) + def str2datetime(s): parts = s.split('.') dt = datetime.strptime(parts[0], "%Y-%m-%d %H:%M:%S") @@ -29,14 +45,14 @@ if __name__ == '__main__': begin_time = None next_begin_time = None cnt = 0 - lat = 0 + lats = [] timestamps = [] values = [] for line in sys.stdin: m = commit_pat.match(line) if m: timestamps.append(str2datetime(m.group(1))) - lat += float(m.group(2)) + lats.append(float(m.group(2))) timestamps.sort() for timestamp in timestamps: if begin_time and timestamp < next_begin_time: @@ -49,5 +65,7 @@ if __name__ == '__main__': cnt = 1 values.append(cnt) print(values) - print("lat = {:.3f}ms".format(lat / len(timestamps) * 1e3)) + print("lat = {:.3f}ms".format(sum(lats) / len(lats) * 1e3)) + lats, _ = remove_outliers(lats) + print("lat = {:.3f}ms".format(sum(lats) / len(lats) * 1e3)) plot_thr(args.output) |