| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os, shutil | 5 import os, shutil |
| 6 from autotest_lib.client.bin import test, utils | 6 from autotest_lib.client.bin import test, utils |
| 7 | 7 |
| 8 class realtimecomm_GTalkAudioBench(test.test): | 8 class realtimecomm_GTalkAudioBench(test.test): |
| 9 version = 1 | 9 version = 1 |
| 10 performance_results = {} | 10 performance_results = {} |
| 11 codecs = [ | 11 codecs = [ |
| 12 'IPCMWB', | 12 'IPCMWB', |
| 13 'ISAC', | 13 'ISAC', |
| 14 'ISACLC', | 14 'ISACLC', |
| 15 'EG711U', | 15 'EG711U', |
| 16 'EG711A', | 16 'EG711A', |
| 17 'PCMU', | 17 'PCMU', |
| 18 'PCMA', | 18 'PCMA', |
| 19 'iLBC', | 19 'iLBC', |
| 20 'G722', | 20 'G722', |
| 21 'GSM', | 21 'GSM', |
| 22 # 'speex', | 22 # 'speex', |
| 23 # 'red', | 23 # 'red', |
| 24 # 'telephone-event', | 24 # 'telephone-event', |
| 25 # 'CN', | 25 # 'CN', |
| 26 ] | 26 ] |
| 27 # TODO(zhurunz): Support ARM once available. | 27 |
| 28 gips_path = '/home/autotest/gips' | 28 def setup(self): |
| 29 gips = os.path.join(gips_path, 'audiotesttool.i686') | 29 # TODO(zhurunz): Support ARM once available. |
| 30 self.gips_path = os.path.join(self.autodir, 'gips') |
| 31 self.gips = os.path.join(self.gips_path, 'audiotesttool.i686') |
| 32 |
| 30 | 33 |
| 31 def run_once(self): | 34 def run_once(self): |
| 32 # Setup as appropriate | 35 # Setup as appropriate |
| 33 shutil.rmtree(self.gips_path, ignore_errors=True) | 36 shutil.rmtree(self.gips_path, ignore_errors=True) |
| 34 shutil.copytree(self.bindir, self.gips_path) | 37 shutil.copytree(self.bindir, self.gips_path) |
| 35 utils.run('chown chronos %s -R' % self.gips_path) | 38 utils.run('chown chronos %s -R' % self.gips_path) |
| 36 | 39 |
| 37 # Run all codecs | 40 # Run all codecs |
| 38 for codec in self.codecs: | 41 for codec in self.codecs: |
| 39 self.__run_one_codec(codec.lower()) | 42 self.__run_one_codec(codec.lower()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 51 utils.system_output, cmd, retain_output=True) | 54 utils.system_output, cmd, retain_output=True) |
| 52 self.performance_results['utime_gtalk_%s_enc' % codec] = cpu_usage | 55 self.performance_results['utime_gtalk_%s_enc' % codec] = cpu_usage |
| 53 | 56 |
| 54 # Decode | 57 # Decode |
| 55 para = "--codec=%s decode output.rtp output.wav" % codec | 58 para = "--codec=%s decode output.rtp output.wav" % codec |
| 56 cmd = "cd %s && su chronos -c '%s %s'" % \ | 59 cmd = "cd %s && su chronos -c '%s %s'" % \ |
| 57 (self.gips_path, self.gips, para) | 60 (self.gips_path, self.gips, para) |
| 58 cpu_usage, stdout = utils.get_cpu_percentage( | 61 cpu_usage, stdout = utils.get_cpu_percentage( |
| 59 utils.system_output, cmd, retain_output=True) | 62 utils.system_output, cmd, retain_output=True) |
| 60 self.performance_results['utime_gtalk_%s_dec' % codec] = cpu_usage | 63 self.performance_results['utime_gtalk_%s_dec' % codec] = cpu_usage |
| OLD | NEW |