diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2011-06-28 23:09:00 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2011-06-28 23:09:00 -0400 |
commit | 1262f710b548100e4522866341febba3d7cf535d (patch) | |
tree | da397732d6a574bfeccbb3a6ddb6ce9330e4165b /indra/llcommon/llsys.cpp | |
parent | 26be53aede499182252bb797e798611169ea0553 (diff) |
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().
Diffstat (limited to 'indra/llcommon/llsys.cpp')
-rw-r--r-- | indra/llcommon/llsys.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index ccd6f261b7..f0f98f5bf6 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -853,17 +853,14 @@ void LLMemoryInfo::stream(std::ostream& s) const s << pfx << "Total Physical KB: " << phys << std::endl; #elif LL_LINUX - LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb"); - if(meminfo) + std::ifstream meminfo(MEMINFO_FILE); + if (meminfo.is_open()) { - char line[MAX_STRING]; /* Flawfinder: ignore */ - memset(line, 0, sizeof(line)); - while(fgets(line, sizeof(line), meminfo)) + std::string line; + while (std::getline(meminfo, line)) { - line[strlen(line)-1] = ' '; /*Flawfinder: ignore*/ - s << pfx << line; + s << pfx << line << '\n'; } - fclose(meminfo); } else { |