Home | History | Annotate | Download | only in kernel_HdParm
      1 #!/usr/bin/python
      2 #
      3 # Copyright (c) 2011-2012 The Chromium Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 import logging, re
      8 
      9 from autotest_lib.client.bin import test, utils
     10 
     11 
     12 class kernel_HdParm(test.test):
     13     """
     14     Measure disk performance: both disk (-t) and cache (-T).
     15     """
     16     version = 1
     17 
     18     def run_once(self):
     19         disk = utils.get_fixed_dst_drive()
     20 
     21         logging.debug("Using device %s", disk)
     22 
     23         result = utils.system_output('hdparm -T %s' % disk)
     24         match = re.search('(\d+\.\d+) MB\/sec', result)
     25         self.write_perf_keyval({'cache_throughput': match.groups()[0]})
     26         result = utils.system_output('hdparm -t %s' % disk)
     27         match = re.search('(\d+\.\d+) MB\/sec', result)
     28         self.write_perf_keyval({'disk_throughput': match.groups()[0]})
     29