aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skpbench/_hardware.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/skpbench/_hardware.py')
-rw-r--r--tools/skpbench/_hardware.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/skpbench/_hardware.py b/tools/skpbench/_hardware.py
new file mode 100644
index 0000000000..23cfc827bc
--- /dev/null
+++ b/tools/skpbench/_hardware.py
@@ -0,0 +1,29 @@
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import time
+
+class HardwareException(Exception):
+ def __init__(self, message, sleeptime=60):
+ Exception.__init__(self, message)
+ self.sleeptime = sleeptime
+
+class Hardware:
+ def __init__(self):
+ self.kick_in_time = 0
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exception_type, exception_value, traceback):
+ pass
+
+ def sanity_check(self):
+ '''Raises a HardwareException if any hardware state is not as expected.'''
+ pass
+
+ def sleep(self, sleeptime):
+ '''Puts the hardware into a resting state for a fixed amount of time.'''
+ time.sleep(sleeptime)