Regular expression in power.py intermittently obtains proportional power usage
Categories
(Testing :: Raptor, defect, P1)
Tracking
(firefox69 fixed)
| Tracking | Status | |
|---|---|---|
| firefox69 | --- | fixed |
People
(Reporter: sparky, Assigned: sparky)
References
Details
Attachments
(1 file)
Currently, the regular expression used to capture the power usage info for a given application (uid) is the following:
re_power = re.compile(
r"\s+Uid %s:\s+([\d.]+) ([(] cpu=([\d.]+) wifi=([\d.]+) [)] "
r"Including smearing: ([\d.]+))?" % uid
)
However, this RE fails to obtain the proportional power usage when wifi cannot be found in the line that is being searched.
For example, using the following string: " Uid u0a424: 0.573 ( cpu=0.573 ) Including smearing: 0.654 ( proportional=0.0810 )"
From match.groups() we obtain: ('0.573', None, None, None, None)
And this results in android8 == None preventing us from proceeding to the proportional usage parsing found here.
If we add wifi=1 to the string: " Uid u0a424: 0.573 ( cpu=0.573 wifi=1 ) Including smearing: 0.654 ( proportional=0.0810 )"
Then we obtian the expected result: ('0.573', '( cpu=0.573 wifi=1 ) Including smearing: 0.654', '0.573', '1', '0.654')
:bc, I believe that this is a bug, but before I make any changes I am wondering if this behaviour was intentional? I ran these tests on a GP2 with Android 8.
| Assignee | ||
Updated•7 years ago
|
Comment 1•7 years ago
|
||
No, it is not intentional to drop the match if wifi isn't available. I'm ok with you adjusting the code to handle the case where wifi is missing.
Updated•7 years ago
|
Comment 2•7 years ago
|
||
I believe a fix for this is included in the patch for bug 1553335. Is that correct :sparky?
| Assignee | ||
Comment 4•6 years ago
|
||
This patch fixes the regular expressions used to parse power usage info from batterystats output on Android 7+. With these changes, we no longer intermittently obtain measurements (such as proportional) due to pattern matching failures.
Comment 6•6 years ago
|
||
| bugherder | ||
Description
•