summaryrefslogtreecommitdiff
path: root/src/user/app/iostress/iostress.c
diff options
context:
space:
mode:
authordzwdz2022-08-02 12:15:56 +0200
committerdzwdz2022-08-02 12:15:56 +0200
commitee3152b239c78ca8888a95b308eb6f0a4aaabe2f (patch)
tree4f561add342ba1f9d57d2c9a87b15a69d1a6edb0 /src/user/app/iostress/iostress.c
parent341961b59eb08bfbbb1cc2a43704b8916142a5b2 (diff)
user/ansiterm: only write() the part of the framebuffer that changed
Diffstat (limited to 'src/user/app/iostress/iostress.c')
-rw-r--r--src/user/app/iostress/iostress.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/user/app/iostress/iostress.c b/src/user/app/iostress/iostress.c
new file mode 100644
index 0000000..843a19a
--- /dev/null
+++ b/src/user/app/iostress/iostress.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <camellia/syscalls.h>
+#include <x86intrin.h>
+
+#define NUM_RUNS 4
+#define NUM_CALLS 512
+
+int main(void) {
+ uint64_t time;
+ uint64_t results[8];
+
+ for (int i = 0; i < NUM_RUNS; i++) {
+ time = __rdtsc();
+ for (int j = 0; j < NUM_CALLS; j++)
+ _syscall_write(1, ".", 1, -1, 0);
+ _syscall_write(1, "\n", 1, -1, 0);
+ results[i] = __rdtsc() - time;
+ }
+
+ for (int i = 0; i < NUM_RUNS; i++) {
+ printf("run %x: %x\n", i, results[i] / 3000);
+ }
+
+ return 0;
+}