Skip to content
Snippets Groups Projects
Commit 61a8a07e authored by Avinankumar Vellore Suriyakumar's avatar Avinankumar Vellore Suriyakumar
Browse files

Fix process usage parser

Ensure the last process stats are added to the list

Change-Id: Iba910f079748196650d1934249c47821abeb7913
parent edafa599
Branches
No related tags found
No related merge requests found
......@@ -84,6 +84,12 @@ public class ProcessUsageParser implements IParser {
alarmWakeups = Integer.parseInt(m.group(1));
}
}
// Add the last process usage stats to the list
if (processUid != null) {
// Save the process usage info for the previous process
mItem.addProcessUsage(processUid, alarmWakeups, mSensorUsage);
}
return mItem;
}
......
......
......@@ -54,11 +54,12 @@ public class ProcessUsageParserTest extends TestCase {
" Proc servicemanager:",
" CPU: 2s 20ms usr + 4s 60ms krn ; 0ms fg",
" Apk android:",
" 2 wakeup alarms");
" 2 wakeup alarms",
" ");
ProcessUsageItem processUsage = new ProcessUsageParser().parse(inputBlock);
assertEquals(2, processUsage.getProcessUsage().size());
assertEquals(3, processUsage.getProcessUsage().size());
LinkedList<ProcessUsageInfoItem> processUsageInfo =
(LinkedList<ProcessUsageInfoItem>)processUsage.getProcessUsage();
......@@ -69,6 +70,9 @@ public class ProcessUsageParserTest extends TestCase {
LinkedList<SensorInfoItem> sensor = processUsageInfo.get(1).getSensorUsage();
assertEquals("44", sensor.get(0).getSensorName());
assertEquals("36", sensor.get(1).getSensorName());
sensor = processUsageInfo.get(2).getSensorUsage();
assertEquals("0", sensor.get(0).getSensorName());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment