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

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:be7d908cd236
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.
4
5 """Provides an interface to communicate with the device via the adb command.
6
7 Assumes adb binary is currently on system path.
8 """
9
10
11 import collections
12
13
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