lmkd/tests: do not fail when occasionally reaping time is reported as 0
In rare cases the process reaping time is short enough that it is reported as 0. Prevent the test from failing in this rare case. Bug: 296555636 Change-Id: I8484958eb9561ba345008195be8b6a7bd94e9ef3 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
parent
6c4dbbadb4
commit
90c4e26b9f
|
|
@ -228,12 +228,15 @@ TEST_F(LmkdTest, TargetReaping) {
|
|||
line = logcat_out.substr(
|
||||
line_start, line_end == std::string::npos ? std::string::npos : line_end - line_start);
|
||||
long reap_time;
|
||||
ASSERT_TRUE(ParseReapTime(line, pid, reap_time) && reap_time > 0)
|
||||
ASSERT_TRUE(ParseReapTime(line, pid, reap_time) && reap_time >= 0)
|
||||
<< "Reaping time report format is invalid";
|
||||
|
||||
// occasionally the reaping happens quickly enough that it's reported as 0ms
|
||||
if (reap_time > 0) {
|
||||
double reclaim_speed = ((double)rss + swap) / reap_time;
|
||||
GTEST_LOG_(INFO) << "Reclaim speed " << reclaim_speed << "kB/ms (" << rss << "kB rss + " << swap
|
||||
<< "kB swap) / " << reap_time << "ms";
|
||||
GTEST_LOG_(INFO) << "Reclaim speed " << reclaim_speed << "kB/ms (" << rss << "kB rss + "
|
||||
<< swap << "kB swap) / " << reap_time << "ms";
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue