mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
bug 1237619: Add system and command metadata to resouce_usage.json r=gps
This adds metadata about the local system to resource_usage.json that will be useful for analysis when we start collecting these results. Some of it is redundant with data collected for individual tiers, but having it available at a top level should make analysis easier. --HG-- extra : rebase_source : 43b2f6335a4de9c7843f75a3461d2871a97b7752
This commit is contained in:
parent
ad24f01e02
commit
84c48e39bd
@ -8,6 +8,7 @@ import getpass
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
@ -371,7 +372,8 @@ class BuildMonitor(MozbuildObject):
|
||||
'Swap in/out (MB): {sin}/{sout}')
|
||||
|
||||
o = dict(
|
||||
version=1,
|
||||
version=2,
|
||||
argv=sys.argv,
|
||||
start=self.start_time,
|
||||
end=self.end_time,
|
||||
duration=self.end_time - self.start_time,
|
||||
@ -403,6 +405,31 @@ class BuildMonitor(MozbuildObject):
|
||||
|
||||
o['resources'].append(entry)
|
||||
|
||||
# TODO: it would be nice to collect data on the storage device as well
|
||||
o['system'] = dict(
|
||||
architecture=list(platform.architecture()),
|
||||
logical_cpu_count=psutil.cpu_count(),
|
||||
machine=platform.machine(),
|
||||
physical_cpu_count=psutil.cpu_count(logical=False),
|
||||
python_version=platform.python_version(),
|
||||
release=platform.release(),
|
||||
system=platform.system(),
|
||||
swap_total=psutil.swap_memory()[0],
|
||||
version=platform.version(),
|
||||
vmem_total=psutil.virtual_memory()[0],
|
||||
)
|
||||
|
||||
if platform.system() == 'Linux':
|
||||
dist = list(platform.linux_distribution())
|
||||
o['system']['linux_distribution'] = dist
|
||||
elif platform.system() == 'Windows':
|
||||
win32_ver=list((platform.win32_ver())),
|
||||
o['system']['win32_ver'] = win32_ver
|
||||
elif platform.system() == 'Darwin':
|
||||
# mac version is a special Cupertino snowflake
|
||||
r, v, m = platform.mac_ver()
|
||||
o['system']['mac_ver'] = [r, list(v), m]
|
||||
|
||||
return o
|
||||
|
||||
def _log_resource_usage(self, prefix, m_type, duration, cpu_percent,
|
||||
|
@ -56,8 +56,8 @@ var currentResources;
|
||||
* Interface for a build resources JSON file.
|
||||
*/
|
||||
function BuildResources(data) {
|
||||
if (data.version != 1) {
|
||||
throw new Error("Only version 1 of the JSON format is supported.");
|
||||
if (data.version != 1 && data.version != 2) {
|
||||
throw new Error("Unsupported version of the JSON format: " + data.version);
|
||||
}
|
||||
|
||||
this.resources = [];
|
||||
|
Loading…
Reference in New Issue
Block a user