mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Fixing reading of /proc/meminfo
This commit is contained in:
parent
71e5cfe3ca
commit
e2cee2576d
@ -779,9 +779,27 @@ void AsynchronousMetrics::update(std::chrono::system_clock::time_point update_ti
|
|||||||
|
|
||||||
uint64_t kb = 0;
|
uint64_t kb = 0;
|
||||||
readText(kb, *meminfo);
|
readText(kb, *meminfo);
|
||||||
if (kb)
|
|
||||||
|
if (!kb)
|
||||||
{
|
{
|
||||||
|
skipToNextLineOrEOF(*meminfo);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
skipWhitespaceIfAny(*meminfo, true);
|
skipWhitespaceIfAny(*meminfo, true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not all entries in /proc/meminfo contain the kB suffix, e.g.
|
||||||
|
* HugePages_Total: 0
|
||||||
|
* HugePages_Free: 0
|
||||||
|
* We simply skip such entries as they're not needed
|
||||||
|
*/
|
||||||
|
if (*meminfo->position() == '\n')
|
||||||
|
{
|
||||||
|
skipToNextLineOrEOF(*meminfo);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
assertString("kB", *meminfo);
|
assertString("kB", *meminfo);
|
||||||
|
|
||||||
uint64_t bytes = kb * 1024;
|
uint64_t bytes = kb * 1024;
|
||||||
@ -816,7 +834,6 @@ void AsynchronousMetrics::update(std::chrono::system_clock::time_point update_ti
|
|||||||
{
|
{
|
||||||
new_values["OSMemorySwapCached"] = bytes;
|
new_values["OSMemorySwapCached"] = bytes;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
skipToNextLineOrEOF(*meminfo);
|
skipToNextLineOrEOF(*meminfo);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user