Closed Bug 1555796 Opened 5 years ago Closed 5 years ago

Regular expression in power.py intermittently obtains proportional power usage

Categories

(Testing :: Raptor, defect, P1)

Version 3
defect

Tracking

(firefox69 fixed)

RESOLVED FIXED
mozilla69
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.

Flags: needinfo?(bob)

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.

Flags: needinfo?(bob)
Priority: -- → P1

I believe a fix for this is included in the patch for bug 1553335. Is that correct :sparky?

Assignee: nobody → gmierz2
Flags: needinfo?(gmierz2)

Yes, that's correct.

Flags: needinfo?(gmierz2)

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.

Blocks: 1511347
Blocks: 1561729
Pushed by gmierz2@outlook.com:
https://hg.mozilla.org/integration/autoland/rev/c1325ef278b4
Fix regular expressions for Android power usage parsing. r=perftest-reviewers,davehunt
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: