-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
René Scharfe
authored and
Junio C Hamano
committed
Jun 10, 2013
1 parent
edca415
commit 1ecb5ff
Showing
4 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |