Starting work on scripts to automate benchmarking.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 22 Sep 2010 20:52:28 +0000 (13:52 -0700)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 22 Sep 2010 20:52:28 +0000 (13:52 -0700)
microbench/microbench.py [new file with mode: 0755]
microbench/setup/build-fs [new file with mode: 0755]

diff --git a/microbench/microbench.py b/microbench/microbench.py
new file mode 100755 (executable)
index 0000000..3e0cd4d
--- /dev/null
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+
+import os, subprocess, sys, time
+
+MNTDIR = '/mnt/bluesky'
+SERVER = 'c09-45.sysnet.ucsd.edu'
+
+class TestClient:
+    def setup_client(self, export):
+        subprocess.check_call(['mount', '-t', 'nfs',
+                               '-o', 'vers=3,tcp,rw,soft,intr',
+                               export, MNTDIR])
+
+    def cleanup_client(self):
+        subprocess.check_call(['umount', '-f', MNTDIR])
+
+    def run(self, export):
+        self.setup_client(export)
+        try:
+            results = self.run_test()
+        finally:
+            self.cleanup_client()
+        return results
+
+class BlueSkyServer:
+    def setup_server(self):
+        subprocess.call(['ssh', SERVER, ''])
+
+class SerialStat(TestClient):
+    """Call stat() on a set of files sequentially and measure the response time
+    for each call."""
+
+    def run_test(self):
+        files = [MNTDIR + "/file-%d" % (i,) for i in range(8)]
+
+        times = []
+        for f in files:
+            start = time.time()
+            os.stat(f)
+            times.append(time.time() - start)
+
+        return times
+
+if __name__ == '__main__':
+    test = SerialStat()
+    print test.run('niniel.sysnet.ucsd.edu:/export')
diff --git a/microbench/setup/build-fs b/microbench/setup/build-fs
new file mode 100755 (executable)
index 0000000..b171211
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Create a directory with a number of small files.  Space out the creation of
+# each file by several seconds so that for BlueSky, without running the
+# cleaner, the inodes should end up in separate log files in the cloud.
+mkdir small
+for i in {0..15}; do
+    sleep 5
+    dd if=/dev/urandom bs=4k count=1 of=small/file-$i
+done