MCPcopy Create free account
hub / github.com/Tencent/libpag / GetMemorySizeUnit

Function GetMemorySizeUnit

viewer/src/utils/StringUtils.cpp:39–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39QString GetMemorySizeUnit(int64_t size) {
40 constexpr int64_t kbThreshold = 1024;
41 constexpr int64_t mbThreshold = 1024 * 1024;
42 constexpr int64_t gbThreshold = 1024 * 1024 * 1024;
43 if (size < kbThreshold) {
44 return "B";
45 }
46 if (size < mbThreshold) {
47 return "KB";
48 }
49 if (size < gbThreshold) {
50 return "MB";
51 }
52 return "GB";
53}
54
55QString GetMemorySizeNumString(int64_t size) {
56 constexpr double kbThreshold = 1024;

Callers 1

setPAGFileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected