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

Unified Diff: build/android/pylib/io_stats_parser.py

Issue 10689132: [android] Upstream / sync most of build/android and build/android/pylib. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | build/android/pylib/perf_tests_helper.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/io_stats_parser.py
diff --git a/build/android/pylib/io_stats_parser.py b/build/android/pylib/io_stats_parser.py
new file mode 100644
index 0000000000000000000000000000000000000000..89097abbc608aff3a3e2ec439215e96e8cc5bd93
--- /dev/null
+++ b/build/android/pylib/io_stats_parser.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Provides an interface to communicate with the device via the adb command.
+
+Assumes adb binary is currently on system path.
+"""
+
+
+import collections
+
+
+def ParseIoStatsLine(line):
+ """Parses a line of io stats into a IoStats named tuple."""
+ # Field definitions: http://www.kernel.org/doc/Documentation/iostats.txt
+ IoStats = collections.namedtuple('IoStats',
+ ['device',
+ 'num_reads_issued',
+ 'num_reads_merged',
+ 'num_sectors_read',
+ 'ms_spent_reading',
+ 'num_writes_completed',
+ 'num_writes_merged',
+ 'num_sectors_written',
+ 'ms_spent_writing',
+ 'num_ios_in_progress',
+ 'ms_spent_doing_io',
+ 'ms_spent_doing_io_weighted',
+ ])
+ fields = line.split()
+ return IoStats._make([fields[2]] + [int(f) for f in fields[3:]])
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | build/android/pylib/perf_tests_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698