Format time in human-readable units
(seconds)
| 503 | |
| 504 | |
| 505 | def format_time(seconds): |
| 506 | """Format time in human-readable units""" |
| 507 | if seconds < 1e-6: |
| 508 | return f"{seconds * 1e9:.2f} ns" |
| 509 | elif seconds < 1e-3: |
| 510 | return f"{seconds * 1e6:.2f} us" |
| 511 | elif seconds < 1: |
| 512 | return f"{seconds * 1e3:.2f} ms" |
| 513 | else: |
| 514 | return f"{seconds:.2f} s" |
| 515 | |
| 516 | |
| 517 | def micro_benchmark(): |