From 00766fbf8f1014b44a9d79c525bc6376538825b7 Mon Sep 17 00:00:00 2001
From: Tom Smeding <tom.smeding@gmail.com>
Date: Tue, 8 Oct 2019 16:47:02 +0200
Subject: Sane indentation

---
 disk_perf.c | 94 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/disk_perf.c b/disk_perf.c
index 81c4095..9efd97a 100644
--- a/disk_perf.c
+++ b/disk_perf.c
@@ -8,61 +8,61 @@
 #include <sys/time.h>
 
 static uint64_t gettimestamp() {
-  struct timeval tv;
-  gettimeofday(&tv, NULL);
-  return tv.tv_sec * 1000000ULL + tv.tv_usec;
+	struct timeval tv;
+	gettimeofday(&tv, NULL);
+	return tv.tv_sec * 1000000ULL + tv.tv_usec;
 }
 
 static void writeall(int fd, const void *buf, size_t count) {
-  size_t cursor = 0;
-  while (cursor < count) {
-    ssize_t written = write(fd, buf + cursor, count - cursor);
-    if (written < 0) {
-      perror("write");
-      exit(1);
-    }
-    assert(written > 0);
-    cursor += written;
-  }
+	size_t cursor = 0;
+	while (cursor < count) {
+		ssize_t written = write(fd, buf + cursor, count - cursor);
+		if (written < 0) {
+			perror("write");
+			exit(1);
+		}
+		assert(written > 0);
+		cursor += written;
+	}
 }
 
 int main(int argc, char **argv) {
-  if (argc != 2) {
-    fprintf(stderr, "Usage: %s <temp file to use>\n", argv[0]);
-    fprintf(stderr,
-        "This will write some data to a file as many times per second as\n"
-        "possible, calling fsync() after each write to make sure it is\n"
-        "persisted. This gives an upper bound on the number of ACID transactions\n"
-        "a single-threaded database can achieve on a disk.\n"
-		"The amount of data in one write is currently 18 bytes.\n"
-    );
-    return 1;
-  }
+	if (argc != 2) {
+		fprintf(stderr, "Usage: %s <temp file to use>\n", argv[0]);
+		fprintf(stderr,
+				"This will write some data to a file as many times per second as\n"
+				"possible, calling fsync() after each write to make sure it is\n"
+				"persisted. This gives an upper bound on the number of ACID transactions\n"
+				"a single-threaded database can achieve on a disk.\n"
+				"The amount of data in one write is currently 18 bytes.\n"
+		);
+		return 1;
+	}
 
-  int fd = open(argv[1], O_WRONLY | O_CREAT, 0644);
-  if (fd < 0) {
-    perror("open");
-    return 1;
-  }
+	int fd = open(argv[1], O_WRONLY | O_CREAT, 0644);
+	if (fd < 0) {
+		perror("open");
+		return 1;
+	}
 
-  uint64_t start_stamp = gettimestamp();
-  size_t num_writes = 0;
-  for (size_t i = 0; ; i++) {
-    const char *str = "abcdefgh=01234567\n";
-    writeall(fd, str, strlen(str));
-    fsync(fd);
-    num_writes++;
+	uint64_t start_stamp = gettimestamp();
+	size_t num_writes = 0;
+	for (size_t i = 0; ; i++) {
+		const char *str = "abcdefgh=01234567\n";
+		writeall(fd, str, strlen(str));
+		fsync(fd);
+		num_writes++;
 
-    if (i % 100 == 0) {
-      uint64_t now = gettimestamp();
-      double secs = (double)(now - start_stamp) / 1000000;
-      if (secs >= 4.0) {
-        printf("Speed: %zu writes in %lf seconds = %lf w/s\n",
-               num_writes, secs, num_writes / secs);
+		if (i % 100 == 0) {
+			uint64_t now = gettimestamp();
+			double secs = (double)(now - start_stamp) / 1000000;
+			if (secs >= 4.0) {
+				printf("Speed: %zu writes in %lf seconds = %lf w/s\n",
+						num_writes, secs, num_writes / secs);
 
-        start_stamp = now;
-        num_writes = 0;
-      }
-    }
-  }
+				start_stamp = now;
+				num_writes = 0;
+			}
+		}
+	}
 }
-- 
cgit v1.2.3-70-g09d2