OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 sys | 5 import sys |
6 | 6 |
7 from metrics import Metric | 7 from metrics import Metric |
8 from telemetry.value import scalar | 8 from telemetry.value import scalar |
9 | 9 |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 return | 35 return |
36 | 36 |
37 def AddSummariesForProcessType(process_type_io, process_type_trace): | 37 def AddSummariesForProcessType(process_type_io, process_type_trace): |
38 """For a given process type, add all relevant summary results. | 38 """For a given process type, add all relevant summary results. |
39 | 39 |
40 Args: | 40 Args: |
41 process_type_io: Type of process (eg Browser or Renderer). | 41 process_type_io: Type of process (eg Browser or Renderer). |
42 process_type_trace: String to be added to the trace name in the results. | 42 process_type_trace: String to be added to the trace name in the results. |
43 """ | 43 """ |
44 | 44 |
45 def AddSummaryForOperation(operation_name, trace_name_prefix, units): | 45 def AddSummaryForOperation(operation_name, trace_name_prefix, units, |
| 46 description): |
46 """Adds summary results for an operation in a process. | 47 """Adds summary results for an operation in a process. |
47 | 48 |
48 Args: | 49 Args: |
49 operation_name: The name of the operation, e.g. 'ReadOperationCount' | 50 operation_name: The name of the operation, e.g. 'ReadOperationCount' |
50 trace_name_prefix: The prefix for the trace name. | 51 trace_name_prefix: The prefix for the trace name. |
51 """ | 52 """ |
52 if operation_name in io_stats[process_type_io]: | 53 if operation_name in io_stats[process_type_io]: |
53 value = io_stats[process_type_io][operation_name] | 54 value = io_stats[process_type_io][operation_name] |
54 if units == 'kb': | 55 if units == 'kb': |
55 value = value / 1024 | 56 value = value / 1024 |
56 results.AddSummaryValue( | 57 results.AddSummaryValue( |
57 scalar.ScalarValue(None, trace_name_prefix + process_type_trace, | 58 scalar.ScalarValue(None, trace_name_prefix + process_type_trace, |
58 units, value, important=False)) | 59 units, value, important=False, |
| 60 description=description)) |
59 | 61 |
60 AddSummaryForOperation('ReadOperationCount', 'read_operations_', 'count') | 62 AddSummaryForOperation('ReadOperationCount', 'read_operations_', 'count', |
| 63 'Number of IO read operations.') |
61 AddSummaryForOperation('WriteOperationCount', 'write_operations_', | 64 AddSummaryForOperation('WriteOperationCount', 'write_operations_', |
62 'count') | 65 'count', 'Number of IO write operations.') |
63 AddSummaryForOperation('ReadTransferCount', 'read_bytes_', 'kb') | 66 AddSummaryForOperation('ReadTransferCount', 'read_bytes_', 'kb', |
64 AddSummaryForOperation('WriteTransferCount', 'write_bytes_', 'kb') | 67 'Number of IO bytes read.') |
| 68 AddSummaryForOperation('WriteTransferCount', 'write_bytes_', 'kb', |
| 69 'Number of IO bytes written.') |
65 | 70 |
66 AddSummariesForProcessType('Browser', 'browser') | 71 AddSummariesForProcessType('Browser', 'browser') |
67 AddSummariesForProcessType('Renderer', 'renderer') | 72 AddSummariesForProcessType('Renderer', 'renderer') |
68 AddSummariesForProcessType('Gpu', 'gpu') | 73 AddSummariesForProcessType('Gpu', 'gpu') |
OLD | NEW |