MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / format_size

Function format_size

examples/benchmark.cpp:75–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73// ── Helpers ──────────────────────────────────────────────────────────────────
74
75static std::string format_size(int64_t bytes) {
76 char buf[32];
77 if (bytes >= (int64_t)1024 * 1024 * 1024) {
78 snprintf(buf, sizeof(buf), "%.1f GB", bytes / (1024.0 * 1024.0 * 1024.0));
79 } else if (bytes >= (int64_t)1024 * 1024) {
80 snprintf(buf, sizeof(buf), "%lld MB", (long long)(bytes / (1024 * 1024)));
81 } else {
82 snprintf(buf, sizeof(buf), "%lld KB", (long long)(bytes / 1024));
83 }
84 return buf;
85}
86
87static std::string format_time_short(double ms) {
88 if (ms < 0) return " -";

Callers 2

print_tableFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected