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

Function GetMemorySizeNumString

viewer/src/utils/StringUtils.cpp:55–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55QString GetMemorySizeNumString(int64_t size) {
56 constexpr double kbThreshold = 1024;
57 constexpr double mbThreshold = 1024 * 1024;
58 constexpr double gbThreshold = 1024 * 1024 * 1024;
59 double dSize = static_cast<double>(size);
60 if (dSize < kbThreshold) {
61 return ToQString(size);
62 }
63 if (dSize < mbThreshold) {
64 return ToQString(dSize / static_cast<double>(kbThreshold));
65 }
66 if (dSize < gbThreshold) {
67 return ToQString(dSize / static_cast<double>(mbThreshold));
68 }
69 return ToQString(dSize / static_cast<double>(gbThreshold));
70}
71
72using TagCodeVersionPair = std::pair<TagCode, std::string>;
73static const std::vector<TagCodeVersionPair> TagCodeVersionList = {

Callers 1

setPAGFileMethod · 0.85

Calls 1

ToQStringFunction · 0.85

Tested by

no test coverage detected