media/webrtc/trunk/build/android/pylib/io_stats_parser.py

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 # Use of this source code is governed by a BSD-style license that can be
michael@0 3 # found in the LICENSE file.
michael@0 4
michael@0 5 """Provides an interface to communicate with the device via the adb command.
michael@0 6
michael@0 7 Assumes adb binary is currently on system path.
michael@0 8 """
michael@0 9
michael@0 10
michael@0 11 import collections
michael@0 12
michael@0 13
michael@0 14 def ParseIoStatsLine(line):
michael@0 15 """Parses a line of io stats into a IoStats named tuple."""
michael@0 16 # Field definitions: http://www.kernel.org/doc/Documentation/iostats.txt
michael@0 17 IoStats = collections.namedtuple('IoStats',
michael@0 18 ['device',
michael@0 19 'num_reads_issued',
michael@0 20 'num_reads_merged',
michael@0 21 'num_sectors_read',
michael@0 22 'ms_spent_reading',
michael@0 23 'num_writes_completed',
michael@0 24 'num_writes_merged',
michael@0 25 'num_sectors_written',
michael@0 26 'ms_spent_writing',
michael@0 27 'num_ios_in_progress',
michael@0 28 'ms_spent_doing_io',
michael@0 29 'ms_spent_doing_io_weighted',
michael@0 30 ])
michael@0 31 fields = line.split()
michael@0 32 return IoStats._make([fields[2]] + [int(f) for f in fields[3:]])

mercurial