summaryrefslogtreecommitdiff
path: root/modules/benchmark/sysbench.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2019-08-13 10:49:23 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-08-14 20:02:42 -0700
commitbda4d418a197efab4e54990931630c9d8368d149 (patch)
tree3fe7052c0da6039c6350ea70b3942daa7c1153bd /modules/benchmark/sysbench.c
parent7e628e892485647b6763064be2732f6a38d642e2 (diff)
benchmark: add sysbench cpu
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/benchmark/sysbench.c')
-rw-r--r--modules/benchmark/sysbench.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/benchmark/sysbench.c b/modules/benchmark/sysbench.c
index 479144ba..6ce9314d 100644
--- a/modules/benchmark/sysbench.c
+++ b/modules/benchmark/sysbench.c
@@ -68,6 +68,13 @@ static gboolean sysbench_run(struct sysbench_ctx *ctx) {
ctx->r.result = strtof(pp, NULL);
}
}
+ if (SEQ(ctx->test, "cpu") ) {
+ // events per second: 1674.97
+ if (pp = strstr(p, " events per second:")) {
+ pp = strchr(pp, ':') + 1;
+ ctx->r.result = strtof(pp, NULL);
+ }
+ }
p = next_nl + 1;
}
@@ -141,3 +148,52 @@ void benchmark_memory_quad(void)
sysbench_run(&ctx);
bench_results[BENCHMARK_MEMORY_QUAD] = ctx.r;
}
+
+void benchmark_sbcpu_single(void) {
+ struct sysbench_ctx ctx = {
+ .test = "cpu",
+ .parms = "--threads=1 --time=7"
+ " --cpu-max-prime=10000",
+ .r = EMPTY_BENCH_VALUE};
+ ctx.r.threads_used = 1;
+
+ shell_view_set_enabled(FALSE);
+ shell_status_update("Performing Alexey Kopytov's sysbench CPU benchmark (single thread)...");
+
+ sysbench_run(&ctx);
+ bench_results[BENCHMARK_SBCPU_SINGLE] = ctx.r;
+}
+
+void benchmark_sbcpu_all(void) {
+ int cpu_procs, cpu_cores, cpu_threads;
+ cpu_procs_cores_threads(&cpu_procs, &cpu_cores, &cpu_threads);
+
+ gchar *parms = g_strdup_printf("--threads=%d --time=7 --cpu-max-prime=10000", cpu_threads);
+ struct sysbench_ctx ctx = {
+ .test = "cpu",
+ .parms = parms,
+ .r = EMPTY_BENCH_VALUE};
+ ctx.r.threads_used = cpu_threads;
+
+ shell_view_set_enabled(FALSE);
+ shell_status_update("Performing Alexey Kopytov's sysbench CPU benchmark (Multi-thread)...");
+
+ sysbench_run(&ctx);
+ bench_results[BENCHMARK_SBCPU_ALL] = ctx.r;
+ g_free(parms);
+}
+
+void benchmark_sbcpu_quad(void) {
+ struct sysbench_ctx ctx = {
+ .test = "cpu",
+ .parms = "--threads=4 --time=7"
+ " --cpu-max-prime=10000",
+ .r = EMPTY_BENCH_VALUE};
+ ctx.r.threads_used = 4;
+
+ shell_view_set_enabled(FALSE);
+ shell_status_update("Performing Alexey Kopytov's sysbench CPU benchmark (Four thread)...");
+
+ sysbench_run(&ctx);
+ bench_results[BENCHMARK_SBCPU_QUAD] = ctx.r;
+}