| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import csv | 5 import csv |
| 6 import multiprocessing | 6 import multiprocessing |
| 7 | 7 |
| 8 from telemetry.core import exceptions | 8 from telemetry.core import exceptions |
| 9 from telemetry.core.platform import profiler | 9 from telemetry.core.platform import profiler |
| 10 from telemetry.core.platform.profiler import monsoon | 10 from telemetry.core.platform.profiler import monsoon |
| 11 | 11 |
| 12 | 12 |
| 13 def _CollectData(output_path, is_collecting): | 13 def _CollectData(output_path, is_collecting): |
| 14 mon = monsoon.Monsoon(wait=False) | 14 mon = monsoon.Monsoon(wait=False) |
| 15 mon.SetMaxCurrent(2.0) | |
| 16 # Note: Telemetry requires the device to be connected by USB, but that | 15 # Note: Telemetry requires the device to be connected by USB, but that |
| 17 # puts it in charging mode. This increases the power consumption. | 16 # puts it in charging mode. This increases the power consumption. |
| 18 mon.SetUsbPassthrough(1) | 17 mon.SetUsbPassthrough(1) |
| 19 # Nominal Li-ion voltage is 3.7V, but it puts out 4.2V at max capacity. Use | 18 # Nominal Li-ion voltage is 3.7V, but it puts out 4.2V at max capacity. Use |
| 20 # 4.0V to simulate a "~80%" charged battery. Google "li-ion voltage curve". | 19 # 4.0V to simulate a "~80%" charged battery. Google "li-ion voltage curve". |
| 21 # This is true only for a single cell. (Most smartphones, some tablets.) | 20 # This is true only for a single cell. (Most smartphones, some tablets.) |
| 22 mon.SetVoltage(4.0) | 21 mon.SetVoltage(4.0) |
| 23 | 22 |
| 24 samples = [] | 23 samples = [] |
| 25 try: | 24 try: |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 monsoon.Monsoon(wait=False) | 75 monsoon.Monsoon(wait=False) |
| 77 except EnvironmentError: | 76 except EnvironmentError: |
| 78 return False | 77 return False |
| 79 else: | 78 else: |
| 80 return True | 79 return True |
| 81 | 80 |
| 82 def CollectProfile(self): | 81 def CollectProfile(self): |
| 83 self._is_collecting.clear() | 82 self._is_collecting.clear() |
| 84 self._collector.join() | 83 self._collector.join() |
| 85 return [self._output_path] | 84 return [self._output_path] |
| OLD | NEW |