Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import pyauto_functional | |
| 7 import pyauto | |
| 8 | |
| 9 class GpuMemTest(pyauto.PyUITest): | |
| 10 # Return the number of bytes of GPU memory being used | |
| 11 def _getGpuMemUsage(self): | |
| 12 gpuMemStats = self.GetGpuMemStats() | |
| 13 if gpuMemStats['gpu_active'] == False: | |
| 14 self.fail(msg='GPU process not active.') | |
| 15 return gpuMemStats['gpu_memory_bytes_used'] | |
| 16 | |
| 17 def testSanity(self): | |
|
nduca
2012/07/17 22:40:25
In general, prefer test name that tell someone who
| |
| 18 """Report GPU memory usage when test page with 3D CSS is open.""" | |
| 19 url_3dcss = self.GetFileURLForDataPath('gpu/mem_3dcss.html') | |
| 20 self.NavigateToURL(url_3dcss, 0) | |
| 21 print 'Using ', self._getGpuMemUsage(), ' bytes of GPU memory' | |
|
nduca
2012/07/17 22:40:25
I think the intent of this is that it consumes a l
| |
| 22 | |
| 23 def testOverSubscribe(self): | |
| 24 """Over-subscribe GPU memory.""" | |
| 25 url_3dcss = self.GetFileURLForDataPath('gpu/mem_3dcss.html') | |
| 26 # Let tabs_to_open be the number of instances of mem_3dcss.html that | |
| 27 # will oversubscribe all available GPU memory by a factor of 4 | |
| 28 # TODO - compute this reliably -- this is a wild guess | |
|
nduca
2012/07/17 22:40:25
Hmmm so how are you going to compute this? Doesn't
| |
| 29 tabs_to_open = 2 | |
| 30 # Record memory usage statistics as each new tab is opened | |
| 31 for i in xrange(tabs_to_open): | |
| 32 self.AppendTab(url_3dcss, windex=0) | |
| 33 # TODO - verify that we never exceeded the GPU memory budget | |
|
nduca
2012/07/17 22:40:25
How?
| |
| 34 # TODO - verify that we actually used 'most' of the GPU memory (say, | |
| 35 # half of it), and that the GPU memory manager did kick | |
| 36 # around some resources | |
|
nduca
2012/07/17 22:40:25
Maybe using a fixed amount of memory is good here
| |
| 37 print 'Using ', self._getGpuMemUsage(), ' bytes of GPU memory' | |
|
nduca
2012/07/17 22:40:25
Should we have a test that verifies that we get a
mmocny
2012/07/18 15:20:18
GpuMemoryManager will have unittests here, but tho
| |
| 38 | |
| 39 if __name__ == '__main__': | |
| 40 pyauto_functional.Main() | |
| OLD | NEW |