Chromium Code Reviews| Index: functional/perf.py |
| =================================================================== |
| --- functional/perf.py (revision 110784) |
| +++ functional/perf.py (working copy) |
| @@ -45,6 +45,7 @@ |
| import pyauto_utils |
| import test_utils |
| from youtube import YoutubeTestHelper |
| +from netflix import NetflixTestHelper |
|
dennis_jeffrey
2011/11/21 22:45:10
Move this up right before line 44, so that the app
rohitbm
2011/11/22 00:57:09
Done.
|
| class BasePerfTest(pyauto.PyUITest): |
| @@ -537,6 +538,58 @@ |
| self._RunNewTabTest('NewTabDocs', _RunSingleDocsTabOpen) |
| +class NetflixPerfTest(BasePerfTest, NetflixTestHelper): |
| + """Test Netflix video performance.""" |
| + |
| + def __init__(self, methodName='runTest', **kwargs): |
| + pyauto.PyUITest.__init__(self, methodName, **kwargs) |
| + NetflixTestHelper.__init__(self, self) |
| + |
| + def tearDown(self): |
| + self._SignOut() |
| + pyauto.PyUITest.tearDown(self) |
| + |
| + def testNetflixDroppedFrames(self): |
| + """Measures the Netflix video dropped frames. Runs for 60 secs.""" |
|
dennis_jeffrey
2011/11/21 22:45:10
Clarify that this test measures the dropped frames
rohitbm
2011/11/22 00:57:09
Done.
|
| + self._LoginAndStartPlaying() |
| + # Ignore first 10 seconds of video playing so we get smooth videoplayback. |
| + time.sleep(10) |
| + init_dropped_frames = self.GetVideoDroppedFrames() |
| + dropped_frames = [] |
| + prev_dropped_frames = 0 |
| + for _ in xrange(60): |
| + # Ignoring initial dropped frames of first 10 seconds. |
| + total_dropped_frames = self.GetVideoDroppedFrames() - init_dropped_frames |
| + dropped_frames.append(total_dropped_frames - prev_dropped_frames) |
| + prev_dropped_frames = total_dropped_frames |
| + # Play the video for some time. |
| + time.sleep(1) |
| + self._PrintSummaryResults('NetflixDroppedFrames', dropped_frames, 'frames') |
| + |
| + def testNetflixCPU(self): |
| + """Measures the Netflix video CPU usage. Runs for 60 seconds.""" |
| + self._LoginAndStartPlaying() |
| + # Ignore first 10 seconds of video playing so we get smooth videoplayback. |
| + time.sleep(10) |
| + init_dropped_frames = self.GetVideoDroppedFrames() |
| + init_video_frames = self.GetVideoFrames() |
| + cpu_usage_start = self._GetCPUUsage() |
| + total_shown_frames = 0 |
| + # Play the video for some time. |
| + time.sleep(60) |
| + total_video_frames = self.GetVideoFrames() - init_video_frames |
| + total_dropped_frames = self.GetVideoDroppedFrames() - init_dropped_frames |
| + cpu_usage_end = self._GetCPUUsage() |
| + fraction_non_idle_time =\ |
|
dennis_jeffrey
2011/11/21 22:45:10
nit: put a space right before the \
rohitbm
2011/11/22 00:57:09
Done.
|
| + self._GetFractionNonIdleCPUTime(cpu_usage_start, cpu_usage_end) |
| + # Counting extrapolation for utilization to play the video. |
| + extrapolation_value = fraction_non_idle_time *\ |
|
dennis_jeffrey
2011/11/21 22:45:10
nit: put a space right before the \
rohitbm
2011/11/22 00:57:09
Done.
|
| + (total_video_frames + total_dropped_frames)/total_video_frames |
|
dennis_jeffrey
2011/11/21 22:45:10
add spaces right before and right after the /
rohitbm
2011/11/22 00:57:09
Done.
|
| + logging.info('Netflix CPU extrapolation: %.2f' % extrapolation_value) |
| + self._OutputPerfGraphValue('extrapolation_NetflixCPUExtrapolation', |
| + extrapolation_value) |
| + |
| + |
| class YoutubePerfTest(BasePerfTest, YoutubeTestHelper): |
| """Test Youtube video performance.""" |