summaryrefslogtreecommitdiff
path: root/klm/util/usage.cc
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2013-04-24 10:12:41 +0100
committerKenneth Heafield <github@kheafield.com>2013-04-24 10:12:41 +0100
commit5aee54869aa19cfe9be965e67a472e94449d16da (patch)
tree8f2111e58c4cc4108b8daabb8c38f16adcaff2f0 /klm/util/usage.cc
parent9957c8a43354fe0a81b83659de965d6d0934adf8 (diff)
KenLM 0831569c3137536165b107c6841603c725dfa2b1
Diffstat (limited to 'klm/util/usage.cc')
-rw-r--r--klm/util/usage.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/klm/util/usage.cc b/klm/util/usage.cc
index b8e125d0..ad4dc7b4 100644
--- a/klm/util/usage.cc
+++ b/klm/util/usage.cc
@@ -22,6 +22,11 @@ float FloatSec(const struct timeval &tv) {
return static_cast<float>(tv.tv_sec) + (static_cast<float>(tv.tv_usec) / 1000000.0);
}
#endif
+
+const char *SkipSpaces(const char *at) {
+ for (; *at == ' '; ++at) {}
+ return at;
+}
} // namespace
void PrintUsage(std::ostream &out) {
@@ -32,18 +37,19 @@ void PrintUsage(std::ostream &out) {
return;
}
out << "user\t" << FloatSec(usage.ru_utime) << "\nsys\t" << FloatSec(usage.ru_stime) << '\n';
-
+ out << "CPU\t" << (FloatSec(usage.ru_utime) + FloatSec(usage.ru_stime)) << '\n';
// Linux doesn't set memory usage :-(.
std::ifstream status("/proc/self/status", std::ios::in);
std::string line;
while (getline(status, line)) {
if (!strncmp(line.c_str(), "VmRSS:\t", 7)) {
- out << "VmRSS: " << (line.c_str() + 7) << '\n';
+ out << "RSSCur\t" << SkipSpaces(line.c_str() + 7) << '\n';
break;
} else if (!strncmp(line.c_str(), "VmPeak:\t", 8)) {
- out << "VmPeak: " << (line.c_str() + 8) << '\n';
+ out << "VmPeak\t" << SkipSpaces(line.c_str() + 8) << '\n';
}
}
+ out << "RSSMax\t" << usage.ru_maxrss << " kB" << '\n';
#endif
}