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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial