Skip to content
Snippets Groups Projects
Commit 1262f710 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

CHOP-753: Report Linux memory stats 1/line, like other platforms.

Previous code deliberately flowed the different lines from MEMINFO_FILE
together on a single line, which seems pointless to me, since we want to be
able to grep the viewer log to recognize individual stats.
Also replace classic-C LLFILE* machinery used to read MEMINFO_FILE with
std::ifstream and std::getline().
parent 26be53ae
No related branches found
No related tags found
No related merge requests found
...@@ -853,17 +853,14 @@ void LLMemoryInfo::stream(std::ostream& s) const ...@@ -853,17 +853,14 @@ void LLMemoryInfo::stream(std::ostream& s) const
s << pfx << "Total Physical KB: " << phys << std::endl; s << pfx << "Total Physical KB: " << phys << std::endl;
#elif LL_LINUX #elif LL_LINUX
LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb"); std::ifstream meminfo(MEMINFO_FILE);
if(meminfo) if (meminfo.is_open())
{ {
char line[MAX_STRING]; /* Flawfinder: ignore */ std::string line;
memset(line, 0, sizeof(line)); while (std::getline(meminfo, line))
while(fgets(line, sizeof(line), meminfo))
{ {
line[strlen(line)-1] = ' '; /*Flawfinder: ignore*/ s << pfx << line << '\n';
s << pfx << line;
} }
fclose(meminfo);
} }
else else
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment