Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / tools / perf / metrics / iometric.py
index 464f9a6..b6d9bcc 100644 (file)
@@ -2,18 +2,20 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import sys
+
 from metrics import Metric
-from telemetry.core.platform import factory
 from telemetry.value import scalar
 
+
 class IOMetric(Metric):
   """IO-related metrics, obtained via telemetry.core.Browser."""
 
   @classmethod
   def CustomizeBrowserOptions(cls, options):
-    os_name = factory.GetPlatformBackendForCurrentOS().GetOSName()
-    if os_name != 'mac':
-      # FIXME: Get rid of this on all platforms - http://crbug.com/361049 .
+    # TODO(tonyg): This is the host platform, so not totally correct.
+    if sys.platform != 'darwin':
+      # TODO(playmobil): Get rid of this on all platforms crbug.com/361049.
       options.AppendExtraBrowserArgs('--no-sandbox')
 
   def Start(self, page, tab):
@@ -40,7 +42,8 @@ class IOMetric(Metric):
         process_type_trace: String to be added to the trace name in the results.
       """
 
-      def AddSummaryForOperation(operation_name, trace_name_prefix, units):
+      def AddSummaryForOperation(operation_name, trace_name_prefix, units,
+                                 description):
         """Adds summary results for an operation in a process.
 
         Args:
@@ -53,13 +56,17 @@ class IOMetric(Metric):
             value = value / 1024
           results.AddSummaryValue(
               scalar.ScalarValue(None, trace_name_prefix + process_type_trace,
-                                 units, value, important=False))
+                                 units, value, important=False,
+                                 description=description))
 
-      AddSummaryForOperation('ReadOperationCount', 'read_operations_', 'count')
+      AddSummaryForOperation('ReadOperationCount', 'read_operations_', 'count',
+                             'Number of IO read operations.')
       AddSummaryForOperation('WriteOperationCount', 'write_operations_',
-                             'count')
-      AddSummaryForOperation('ReadTransferCount', 'read_bytes_', 'kb')
-      AddSummaryForOperation('WriteTransferCount', 'write_bytes_', 'kb')
+                             'count', 'Number of IO write operations.')
+      AddSummaryForOperation('ReadTransferCount', 'read_bytes_', 'kb',
+                             'Number of IO bytes read.')
+      AddSummaryForOperation('WriteTransferCount', 'write_bytes_', 'kb',
+                             'Number of IO bytes written.')
 
     AddSummariesForProcessType('Browser', 'browser')
     AddSummariesForProcessType('Renderer', 'renderer')