Revision ea1321e9

View differences:

log_parser.py
160 160
    reconf_ASes = list()
161 161
    max_key = 0
162 162
    key_counter = Counter()
163
    AS_data_all = defaultdict(dict)
163 164
    if args.f and not args.ff:
164 165
        for fname in args.f:
165 166
            AS_number, data, last_message_before_tmp, reconf_temp = parse_file(fname)
......
208 209
            for (dir_path, dir_names, filenames) in walk(args.ff + "/" + dir):
209 210
                fileList.extend(filenames)
210 211
                break
211
            AS_data_all = defaultdict(dict)
212 212
            if dir not in AS_data_all:
213 213
                AS_data_all[dir] = defaultdict(dict)
214 214
            for fname in fileList:
......
324 324
        else:
325 325
            end_secs = max([AS_data[x]['max_secs'] for x in AS_data])
326 326

  
327
        integral_on_time = dict()
328
        if args.ff and not args.f:
329
            integral_list = list()
330
            for dir in AS_data_all:
331
                integral_on_time_dir = dict()
332
                for i in range(reconf_time, end_secs + 1):
333
                    if i not in integral_on_time:
334
                        integral_on_time_dir[i] = 0
335
                    for as_number in AS_data_all[dir]:
336
                        integral_on_time_dir[i] += AS_data_all[dir][as_number]['updates'][i]
337
                print(dir, integral_on_time_dir)
338
                for i in range(reconf_time + 1, end_secs + 1):
339
                    integral_on_time_dir[i] += integral_on_time_dir[i - 1]
340
                integral_list.append(integral_on_time_dir)
341
            for integral in integral_list:
342
                print(integral)
343
            for i in range(reconf_time, end_secs + 1):
344
                for integral in integral_list:
345
                    if i not in integral_on_time:
346
                        integral_on_time[i] = 0
347
                    integral_on_time[i] += integral[i]
348
                integral_on_time[i] /= len(integral_list)
349

  
327 350
        print_in_columns(['time'] + ['sum'] + sorted(AS_data.keys()), width=4)
328 351
        if int(args.d) > 0:
329 352
            if delta > int(args.d):
......
363 386
                    print_in_columns(['-' + str(i)] + ['0'], width=4)
364 387
                    i -= 1
365 388
        total_upd = 0
366
        for i in range(reconf_time, end_secs+1):
367
            tot_udp = 0
368
            for (AS_number, c_data) in sorted(AS_data.items()):
369
                upd = c_data['updates'][i]
370
                total_upd += upd
371
            print_in_columns([str(i), str(total_upd)], width=4)
372

  
389
        if args.f and not args.ff:
390
            for i in range(reconf_time, end_secs+1):
391
                for (AS_number, c_data) in sorted(AS_data.items()):
392
                    upd = c_data['updates'][i]
393
                    total_upd += upd
394
                print_in_columns([str(i), str(total_upd)], width=4)
395
        else:
396
            for i in range(reconf_time, end_secs+1):
397
                """counter = 0
398
                delta = 0
399
                for (AS_number, c_data) in sorted(AS_data.items()):
400
                    upd = 0
401
                    print(AS_number, c_data['updates'])
402
                    if i in c_data['updates']:
403
                        counter += 1
404
                        upd = c_data['updates'][i]
405
                        delta += upd
406
                    if upd > 0:
407
                        total_upd += upd/counter"""
408
                print_in_columns([str(i), str(integral_on_time[i])], width=4)
373 409
main()

Also available in: Unified diff