aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-10-29 22:58:39 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-10-29 22:58:39 +0200
commit20f9c8e05b7516b70c8428365ccab25f9fa27856 (patch)
tree8fe68267d2a4e0ea6f5168ece03dc2dcfaa3bdd4
parentc206691cd621378a03ba4c255699b14b2cef82d6 (diff)
downloadcache-benchmarks-20f9c8e05b7516b70c8428365ccab25f9fa27856.tar.gz
cache-benchmarks-20f9c8e05b7516b70c8428365ccab25f9fa27856.tar.bz2
Minor changes
* Makefile.am (benchmark): New variable FETCHKEYSOPT. * gdbm/newcache: Upgrade. * src/dropcache.c: Call sync before dropping caches. * src/fetchkeys.c: Use CPU user and system times, instead of measuring real execution time. Don't count gdbm_close in the totals. * src/gnuplot.m4: Use bezier instead of csplines.
-rw-r--r--Makefile.am1
m---------gdbm/newcache0
-rw-r--r--src/dropcache.c1
-rw-r--r--src/fetchkeys.c21
-rw-r--r--src/gnuplot.m44
5 files changed, 20 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index 3baad54..2020e06 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,2 +21,3 @@ benchmark:
echo "RUNTESTOPT=$(RUNTESTOPT)"; \
+ echo "FETCHKEYSOPT=$(FETCHKEYSOPT)"; \
echo "include @abs_top_builddir@/src/benchmark.mk") > $$DIRNAME/Makefile; \
diff --git a/gdbm/newcache b/gdbm/newcache
-Subproject 02bc2dc9bee96c0e7d93d23c6f0b7a24d0e1756
+Subproject 274985d77bf2e69dec8d7eb90bd3f752f115f6e
diff --git a/src/dropcache.c b/src/dropcache.c
index 659f00a..ced103c 100644
--- a/src/dropcache.c
+++ b/src/dropcache.c
@@ -16,2 +16,3 @@ main(int argc, char **argv)
}
+ sync();
if (write(fd, "3\n", 2) != 2)
diff --git a/src/fetchkeys.c b/src/fetchkeys.c
index a655a0d..694f4d9 100644
--- a/src/fetchkeys.c
+++ b/src/fetchkeys.c
@@ -11,2 +11,3 @@
#include <sys/stat.h>
+#include <sys/resource.h>
#include "gdbmdefs.h"
@@ -175,2 +176,12 @@ readkeys (char const *name)
+static struct timeval
+get_cpu_time (void)
+{
+ struct rusage usage;
+ struct timeval res;
+ assert (getrusage (RUSAGE_SELF, &usage) == 0);
+ timeradd (&usage.ru_utime, &usage.ru_stime, &res);
+ return res;
+}
+
int
@@ -247,6 +258,6 @@ main (int argc, char **argv)
- gettimeofday (&t_start, NULL);
+ t_start = get_cpu_time ();
dbf = gdbm_open (dbname, 0, GDBM_READER | flags, 00664, NULL);
assert (dbf != NULL);
- gettimeofday (&t_open, NULL);
+ t_open = get_cpu_time ();
@@ -271,3 +282,3 @@ main (int argc, char **argv)
unsigned long long k = (unsigned long long) i * 100 / nkeys;
- gettimeofday (&t_now, NULL);
+ t_now = get_cpu_time ();
timersub (&t_now, &t_start, &td);
@@ -325,3 +336,2 @@ main (int argc, char **argv)
}
- gdbm_close (dbf);
if (verbose)
@@ -330,3 +340,3 @@ main (int argc, char **argv)
{
- gettimeofday (&t_now, NULL);
+ t_now = get_cpu_time ();
timersub (&t_now, &t_start, &td);
@@ -338,2 +348,3 @@ main (int argc, char **argv)
}
+ gdbm_close (dbf);
return status;
diff --git a/src/gnuplot.m4 b/src/gnuplot.m4
index 392eb94..edee22e 100644
--- a/src/gnuplot.m4
+++ b/src/gnuplot.m4
@@ -18,3 +18,3 @@ plot "master.log" \
notitle \
- smooth csplines ls 2, \
+ smooth bezier ls 2, \
"newcache.log" \
@@ -24,2 +24,2 @@ plot "master.log" \
notitle \
- smooth csplines ls 4
+ smooth bezier ls 4

Return to:

Send suggestions and report system problems to the System administrator.