提交 1ecb5ff1 编写于 作者: R René Scharfe 提交者: Junio C Hamano

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: NRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 edca4152
......@@ -190,6 +190,7 @@
/test-mktemp
/test-parse-options
/test-path-utils
/test-read-cache
/test-regex
/test-revision-walking
/test-run-command
......
......@@ -558,6 +558,7 @@ TEST_PROGRAMS_NEED_X += test-mergesort
TEST_PROGRAMS_NEED_X += test-mktemp
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-path-utils
TEST_PROGRAMS_NEED_X += test-read-cache
TEST_PROGRAMS_NEED_X += test-regex
TEST_PROGRAMS_NEED_X += test-revision-walking
TEST_PROGRAMS_NEED_X += test-run-command
......
#!/bin/sh
test_description="Tests performance of reading the index"
. ./perf-lib.sh
test_perf_default_repo
count=1000
test_perf "read_cache/discard_cache $count times" "
test-read-cache $count
"
test_done
#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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册