1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/build/android/pylib/io_stats_parser.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +# Copyright (c) 2012 The Chromium Authors. All rights reserved. 1.5 +# Use of this source code is governed by a BSD-style license that can be 1.6 +# found in the LICENSE file. 1.7 + 1.8 +"""Provides an interface to communicate with the device via the adb command. 1.9 + 1.10 +Assumes adb binary is currently on system path. 1.11 +""" 1.12 + 1.13 + 1.14 +import collections 1.15 + 1.16 + 1.17 +def ParseIoStatsLine(line): 1.18 + """Parses a line of io stats into a IoStats named tuple.""" 1.19 + # Field definitions: http://www.kernel.org/doc/Documentation/iostats.txt 1.20 + IoStats = collections.namedtuple('IoStats', 1.21 + ['device', 1.22 + 'num_reads_issued', 1.23 + 'num_reads_merged', 1.24 + 'num_sectors_read', 1.25 + 'ms_spent_reading', 1.26 + 'num_writes_completed', 1.27 + 'num_writes_merged', 1.28 + 'num_sectors_written', 1.29 + 'ms_spent_writing', 1.30 + 'num_ios_in_progress', 1.31 + 'ms_spent_doing_io', 1.32 + 'ms_spent_doing_io_weighted', 1.33 + ]) 1.34 + fields = line.split() 1.35 + return IoStats._make([fields[2]] + [int(f) for f in fields[3:]])