diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-03-16 14:58:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-16 14:58:43 -0400 |
commit | 4a4f1e44af0c6aa2a27add9d1e114213a580e50d (patch) | |
tree | a2fe4d97dd0400a651c5acd8feb6362000d31206 /src/test/bench.c | |
parent | 7505f452c865ef9ca5be35647032f93bfb392762 (diff) | |
parent | 643c9078c98cb81d51334cf03fdac76166e57f9a (diff) | |
download | tor-4a4f1e44af0c6aa2a27add9d1e114213a580e50d.tar.gz tor-4a4f1e44af0c6aa2a27add9d1e114213a580e50d.zip |
Merge branch 'prop140_21643_diff_only_squashed'
Diffstat (limited to 'src/test/bench.c')
-rw-r--r-- | src/test/bench.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/bench.c b/src/test/bench.c index c3a9d1c4ba..5da9168cdc 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -28,6 +28,7 @@ const char tor_git_revision[] = ""; #include "crypto_curve25519.h" #include "onion_ntor.h" #include "crypto_ed25519.h" +#include "consdiff.h" #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) static uint64_t nanostart; @@ -674,6 +675,27 @@ main(int argc, const char **argv) tor_threads_init(); + if (argc == 4 && !strcmp(argv[1], "diff")) { + init_logging(1); + const int N = 200; + char *f1 = read_file_to_str(argv[2], RFTS_BIN, NULL); + char *f2 = read_file_to_str(argv[3], RFTS_BIN, NULL); + if (! f1 || ! f2) { + perror("X"); + return 1; + } + for (i = 0; i < N; ++i) { + char *diff = consensus_diff_generate(f1, f2); + tor_free(diff); + } + char *diff = consensus_diff_generate(f1, f2); + printf("%s", diff); + tor_free(f1); + tor_free(f2); + tor_free(diff); + return 0; + } + for (i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--list")) { list = 1; |