summaryrefslogtreecommitdiff
path: root/test-read-cache.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2013-06-09 17:39:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-10 00:03:00 (GMT)
commit1ecb5ff141f6e54727c746446b52af51016e662c (patch)
treee2b77c617509a40cc37941d3a3bbb8821b65aba1 /test-read-cache.c
parentedca4152560522a431a51fc0a06147fc680b5b18 (diff)
downloadgit-1ecb5ff141f6e54727c746446b52af51016e662c.zip
git-1ecb5ff141f6e54727c746446b52af51016e662c.tar.gz
git-1ecb5ff141f6e54727c746446b52af51016e662c.tar.bz2
read-cache: add simple performance test
Add the helper test-read-cache, which can be used to call read_cache and discard_cache in a loop as well as a performance check based on it. Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-read-cache.c')
-rw-r--r--test-read-cache.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test-read-cache.c b/test-read-cache.c
new file mode 100644
index 0000000..b25bcf1
--- /dev/null
+++ b/test-read-cache.c
@@ -0,0 +1,13 @@
+#include "cache.h"
+
+int main (int argc, char **argv)
+{
+ int i, cnt = 1;
+ if (argc == 2)
+ cnt = strtol(argv[1], NULL, 0);
+ for (i = 0; i < cnt; i++) {
+ read_cache();
+ discard_cache();
+ }
+ return 0;
+}