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

Side by Side Diff: tracing/tracing/value/add_device_info.py

Issue 2988823002: DeviceInfo into GenericSets (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « tracing/trace_viewer.gypi ('k') | tracing/tracing/value/diagnostics/all_diagnostics.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 json 5 from tracing.value import histogram
6 import tempfile 6 from tracing.value.diagnostics import reserved_infos
7 7
8 from tracing.value import add_shared_diagnostic 8 def AddDeviceInfo(histogram_set, chrome_version, os_name, os_version,
phsilva 2017/07/25 21:15:39 Currently, this function is not being used anywher
9 gpu_info, arch, ram):
10 """Adds a shared diagnostics containing pieces of device information to a
11 HistogramSet.
9 12
10 def AddDeviceInfo(histograms_json_filename, chrome_version, os_name, os_version, 13 Args:
11 gpu_info, arch, ram): 14 histograms_json_filename: a HistogramSet to add the diagnostics to.
15 chrome_version: name of the device's Chrome version.
16 os_name: name of the device's OS.
17 os_version: name of the device's OS version.
18 gpu_info: GPU information of the device
19 arch: name of the device's OS architecture.
20 ram: device's total available ram.
21 """
12 device_info = { 22 device_info = {
13 'chromeVersion': chrome_version, 23 reserved_infos.PRODUCT_VERSIONS.name: chrome_version,
14 'osName': os_name, 24 reserved_infos.OS_NAMES.name: os_name,
15 'osVersion': os_version, 25 reserved_infos.OS_VERSIONS.name: os_version,
16 'gpuInfo': gpu_info, 26 reserved_infos.GPUS.name: gpu_info,
17 'arch': arch, 27 reserved_infos.ARCHITECTURES.name: arch,
18 'ram': ram, 28 reserved_infos.MEMORY_AMOUNTS.name: ram,
19 } 29 }
20 30
21 with tempfile.NamedTemporaryFile() as diagnostic_file: 31 for device_info_name, device_info_value in device_info.iteritems():
phsilva 2017/07/25 21:15:39 This part of the code adds GenericSet diagnostics
benjhayden 2017/07/26 05:21:17 I think you can say 'if device_info_value:' here i
22 json.dump(device_info, diagnostic_file) 32 histogram_set.AddSharedDiagnostic(
23 return add_shared_diagnostic.AddSharedDiagnostic( 33 device_info_name, histogram.GenericSet(device_info_value))
24 histograms_json_filename, 'device', diagnostic_file.name)
OLDNEW
« no previous file with comments | « tracing/trace_viewer.gypi ('k') | tracing/tracing/value/diagnostics/all_diagnostics.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698