MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / HumanReadableSize

Function HumanReadableSize

paddle/utils/string/printf.h:116–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116inline std::string HumanReadableSize(double f_size) {
117 size_t i = 0;
118 double orig = f_size;
119 const std::vector<std::string> units(
120 {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"});
121 while (f_size >= 1024) {
122 f_size /= 1024;
123 i++;
124 }
125 if (i >= units.size()) {
126 return Sprintf("%fB", orig);
127 }
128 return Sprintf("%f%s", f_size, units[i]);
129}
130
131} // namespace string
132} // namespace paddle

Callers 12

AllocateImplMethod · 0.85
AllocMethod · 0.85
MallocThrottlingMethod · 0.85
FreeImplMethod · 0.85
AllocateImplMethod · 0.85
AllocateImplMethod · 0.85
AllocateImplMethod · 0.85
AllocateImplMethod · 0.85
AllocateImplMethod · 0.85
Alloc<GPUPlace>Function · 0.85
CustomPlace>Method · 0.85

Calls 2

SprintfFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected