Index: tools/skpbench/_hardware.py |
diff --git a/tools/skpbench/_hardware.py b/tools/skpbench/_hardware.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..23cfc827bc97ccf44f98dee0549e7a04c564a8c6 |
--- /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) |