udp_scale.py 663 Bytes
Newer Older
Hejing Li's avatar
Hejing Li committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
import os
import pathlib
import shutil
import json

if len(sys.argv) != 2:
    print('Usage: udp_scale.py OUTDIR')
    sys.exit(1)

basedir = sys.argv[1] + '/'
types_of_client = [1, 3, 7, 15, 31]
bw = 1000

for cl in types_of_client:
    log_path = '%sgt-ib-switch-UDPmicro-%d-%d-1.json' % (basedir, bw, cl)

    try:
        log = open(log_path, 'r')
    except:
        print(f'no file: {log_path}')
        continue
    else:
        exp_log = json.load(log)
        start_time = exp_log["start_time"]
        end_time = exp_log["end_time"]
        diff_time = (end_time - start_time)/60 #min
        
        print(diff_time)

        log.close()