mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
Fixed OSX/Linux builds
This commit is contained in:
parent
65cee8d249
commit
e2d7fd941f
1 changed files with 26 additions and 26 deletions
|
@ -366,6 +366,32 @@ std::string xml_escape(std::string text)
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string format_memsize_MB(size_t n)
|
||||||
|
{
|
||||||
|
std::string out;
|
||||||
|
size_t n2 = 0;
|
||||||
|
size_t scale = 1;
|
||||||
|
// Round to MB
|
||||||
|
n += 500000;
|
||||||
|
n /= 1000000;
|
||||||
|
while (n >= 1000) {
|
||||||
|
n2 = n2 + scale * (n % 1000);
|
||||||
|
n /= 1000;
|
||||||
|
scale *= 1000;
|
||||||
|
}
|
||||||
|
char buf[8];
|
||||||
|
sprintf(buf, "%d", n);
|
||||||
|
out = buf;
|
||||||
|
while (scale != 1) {
|
||||||
|
scale /= 1000;
|
||||||
|
n = n2 / scale;
|
||||||
|
n2 = n2 % scale;
|
||||||
|
sprintf(buf, ",%03d", n);
|
||||||
|
out += buf;
|
||||||
|
}
|
||||||
|
return out + "MB";
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#ifndef PROCESS_MEMORY_COUNTERS_EX
|
#ifndef PROCESS_MEMORY_COUNTERS_EX
|
||||||
|
@ -385,32 +411,6 @@ std::string xml_escape(std::string text)
|
||||||
} PROCESS_MEMORY_COUNTERS_EX, *PPROCESS_MEMORY_COUNTERS_EX;
|
} PROCESS_MEMORY_COUNTERS_EX, *PPROCESS_MEMORY_COUNTERS_EX;
|
||||||
#endif /* PROCESS_MEMORY_COUNTERS_EX */
|
#endif /* PROCESS_MEMORY_COUNTERS_EX */
|
||||||
|
|
||||||
std::string format_memsize_MB(size_t n)
|
|
||||||
{
|
|
||||||
std::string out;
|
|
||||||
size_t n2 = 0;
|
|
||||||
size_t scale = 1;
|
|
||||||
// Round to MB
|
|
||||||
n += 500000;
|
|
||||||
n /= 1000000;
|
|
||||||
while (n >= 1000) {
|
|
||||||
n2 = n2 + scale * (n % 1000);
|
|
||||||
n /= 1000;
|
|
||||||
scale *= 1000;
|
|
||||||
}
|
|
||||||
char buf[8];
|
|
||||||
sprintf(buf, "%d", n);
|
|
||||||
out = buf;
|
|
||||||
while (scale != 1) {
|
|
||||||
scale /= 1000;
|
|
||||||
n = n2 / scale;
|
|
||||||
n2 = n2 % scale;
|
|
||||||
sprintf(buf, ",%03d", n);
|
|
||||||
out += buf;
|
|
||||||
}
|
|
||||||
return out + "MB";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string log_memory_info()
|
std::string log_memory_info()
|
||||||
{
|
{
|
||||||
std::string out;
|
std::string out;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue