1 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 import time 5 from autotest_lib.client.bin import test 6 from autotest_lib.client.common_lib import error 7 from autotest_lib.client.cros.graphics import graphics_utils 8 9 class graphics_KernelMemory(test.test): 10 """ 11 Reads from sysfs to determine kernel gem objects and memory info. 12 """ 13 version = 1 14 GSC = None 15 16 def initialize(self): 17 self.GSC = graphics_utils.GraphicsStateChecker() 18 19 def run_once(self): 20 # TODO(ihf): We want to give this test something well-defined to 21 # measure. For now that will be the CrOS login-screen memory use. 22 # We could also log into the machine using telemetry, but that is 23 # still flaky. So for now we, lame as we are, just sleep a bit. 24 time.sleep(10.0) 25 26 keyvals = self.GSC.get_memory_keyvals() 27 for key, val in keyvals.iteritems(): 28 self.output_perf_value(description=key, value=val, 29 units='bytes', higher_is_better=False) 30 self.GSC.finalize() 31 self.write_perf_keyval(keyvals) 32 # We should still be in the login screen and memory use > 0. 33 if self.GSC.get_memory_access_errors() > 0: 34 raise error.TestFail('Detected %d errors accessing graphics ' 35 'memory.' % self.GKM.num_errors) 36