Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: client/common_lib/site_power_status.py

Issue 6580020: Add check for charge_full or charge_now >> charge_full_design. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import glob, logging, os, re, time 1 import glob, logging, os, re, time
2 from autotest_lib.client.bin import utils as bin_utils 2 from autotest_lib.client.bin import utils as bin_utils
3 from autotest_lib.client.common_lib import error, utils 3 from autotest_lib.client.common_lib import error, utils
4 4
5 5
6 class DevStat(object): 6 class DevStat(object):
7 """ 7 """
8 Device power status. This class implements generic status initialization 8 Device power status. This class implements generic status initialization
9 and parsing routines. 9 and parsing routines.
10 """ 10 """
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 def update(self): 83 def update(self):
84 self.read_all_vals() 84 self.read_all_vals()
85 85
86 self.charge_full = self.charge_full / 1000000 86 self.charge_full = self.charge_full / 1000000
87 self.charge_full_design = self.charge_full_design / 1000000 87 self.charge_full_design = self.charge_full_design / 1000000
88 self.charge_now = self.charge_now / 1000000 88 self.charge_now = self.charge_now / 1000000
89 self.current_now = self.current_now / 1000000 89 self.current_now = self.current_now / 1000000
90 self.voltage_min_design = self.voltage_min_design / 1000000 90 self.voltage_min_design = self.voltage_min_design / 1000000
91 self.voltage_now = self.voltage_now / 1000000 91 self.voltage_now = self.voltage_now / 1000000
92 92
93 if self.charge_full > (self.charge_full_design * 1.5):
94 raise error.TestError('Unreasonable charge_full value')
95 if self.charge_now > (self.charge_full_design * 1.5):
96 raise error.TestError('Unreasonable charge_now value')
93 self.energy = self.voltage_now * self.charge_now 97 self.energy = self.voltage_now * self.charge_now
94 self.energy_full = self.voltage_now * self.charge_full 98 self.energy_full = self.voltage_now * self.charge_full
95 self.energy_full_design = self.voltage_now * self.charge_full_design 99 self.energy_full_design = self.voltage_now * self.charge_full_design
96 self.energy_rate = self.voltage_now * self.current_now 100 self.energy_rate = self.voltage_now * self.current_now
97 101
98 self.remaining_time = 0 102 self.remaining_time = 0
99 if self.current_now: 103 if self.current_now:
100 self.remaining_time = self.energy / self.energy_rate 104 self.remaining_time = self.energy / self.energy_rate
101 105
102 106
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 389
386 active = int(utils.read_file(active_duration_path)) 390 active = int(utils.read_file(active_duration_path))
387 connected = int(utils.read_file(connected_duration_path)) 391 connected = int(utils.read_file(connected_duration_path))
388 logging.debug('device %s active for %.2f%%', 392 logging.debug('device %s active for %.2f%%',
389 path, active * 100.0 / connected) 393 path, active * 100.0 / connected)
390 394
391 total_active += active 395 total_active += active
392 total_connected += connected 396 total_connected += connected
393 397
394 return total_active, total_connected 398 return total_active, total_connected
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698