MCPcopy Create free account
hub / github.com/LucaCanali/PyLatencyMap / main

Function main

LatencyMap.py:501–538  ·  view source on GitHub ↗
(argv: list[str] | None = None)

Source from the content-addressed store, hash-verified

499# --------------------------------- Main ------------------------------------ #
500
501def main(argv: list[str] | None = None) -> int:
502 # Parse CLI first so -h/--help works via console script entry point
503 g_params.parse_cli(argv)
504 # Show banner after successful parse (won't print on -h because argparse exits first)
505 g_params.usage_banner()
506 chart = ArrayOfLatencyRecords()
507 first = True
508 previous = LatencyRecord() # dummy previous for first delta computation
509
510 while True:
511 rec = LatencyRecord()
512 rec.go_to_begin_record_tag()
513 try:
514 rec.read_record()
515 except Exception as err:
516 sys.stderr.write(f"ERROR: {err}\n")
517 return 1
518
519 if g_params.debug_level >= 2:
520 print("\nLatest data record:")
521 print(rec.data)
522
523 if first:
524 LatencyRecord._autotune_latency_buckets()
525 first = False
526 else:
527 rec.compute_deltas(previous)
528
529 chart.add_new_record(rec)
530 previous = rec
531
532 chart.render()
533 time.sleep(g_params.screen_delay)
534
535 if g_params.debug_level >= 3:
536 chart.print_frequency_histograms_debug()
537 if g_params.debug_level >= 4:
538 chart.print_intensity_histograms_debug()
539
540
541if __name__ == '__main__':

Callers 1

LatencyMap.pyFile · 0.70

Calls 12

read_recordMethod · 0.95
compute_deltasMethod · 0.95
add_new_recordMethod · 0.95
renderMethod · 0.95
LatencyRecordClass · 0.85
parse_cliMethod · 0.80
usage_bannerMethod · 0.80

Tested by

no test coverage detected