Return a human-readable memory string for the given amount of bytes.
(num_bytes: float)
| 60 | |
| 61 | |
| 62 | def memory_string(num_bytes: float) -> str: |
| 63 | """Return a human-readable memory string for the given amount of bytes.""" |
| 64 | k = 0 |
| 65 | while num_bytes >= 1024 and k < len(memory_units) - 1: |
| 66 | num_bytes /= 1024 |
| 67 | k += 1 |
| 68 | return f"{num_bytes:.1f}{memory_units[k]}" |
| 69 | |
| 70 | |
| 71 | def locality_string(locality_hits: int, locality_misses) -> str: |
no outgoing calls
searching dependent graphs…