| Index: tools/telemetry/telemetry/core/platform/mac_platform_backend.py
|
| diff --git a/tools/telemetry/telemetry/core/platform/mac_platform_backend.py b/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
|
| index 5f27c35c911e696a00326225c2cfa9b8df9d916b..95dbe1bd1bc747578e0385357f410cad42c2a0eb 100644
|
| --- a/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
|
| +++ b/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
|
| @@ -201,7 +201,10 @@ class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend):
|
| # Duration of this sample.
|
| sample_duration_ms = int(plist['elapsed_ns']) / 10**6
|
|
|
| + if 'processor' not in plist:
|
| + continue
|
| processor = plist['processor']
|
| +
|
| energy_consumption_mw = int(processor.get('package_watts', 0)) * 10**3
|
|
|
| total_energy_consumption_mwh += (energy_consumption_mw *
|
| @@ -212,8 +215,9 @@ class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend):
|
| # -------- Collect and Process Data -------------
|
| out_dict = {}
|
| # Raw power usage samples.
|
| - out_dict['power_samples_mw'] = power_samples
|
| - out_dict['energy_consumption_mwh'] = total_energy_consumption_mwh
|
| + if power_samples:
|
| + out_dict['power_samples_mw'] = power_samples
|
| + out_dict['energy_consumption_mwh'] = total_energy_consumption_mwh
|
|
|
| return out_dict
|
|
|
|
|