trace2:data: add trace2 data to midx

Log multi-pack-index command mode. Log number of objects and packfiles in the midx. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed Mar 21, 2019 at 12:36 UTC d829223a4256d2a6f0e07425ba3828d28bda7596
2 files changed +7
builtin/multi-pack-index.c
+3
@@ -3,6 +3,7 @@
3 #include "config.h"
4 #include "parse-options.h"
5 #include "midx.h"
6 +#include "trace2.h"
7
8 static char const * const builtin_multi_pack_index_usage[] = {
9 N_("git multi-pack-index [--object-dir=<dir>] (write|verify)"),
@@ -40,6 +41,8 @@ int cmd_multi_pack_index(int argc, const char **argv,
41 return 1;
42 }
43
44 + trace2_cmd_mode(argv[0]);
45 +
46 if (!strcmp(argv[0], "write"))
47 return write_midx_file(opts.object_dir);
48 if (!strcmp(argv[0], "verify"))
midx.c
+4
@@ -8,6 +8,7 @@
8 #include "sha1-lookup.h"
9 #include "midx.h"
10 #include "progress.h"
11 +#include "trace2.h"
12
13 #define MIDX_SIGNATURE 0x4d494458 /* "MIDX" */
14 #define MIDX_VERSION 1
@@ -164,6 +165,9 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local
165 m->pack_names[i]);
166 }
167
168 + trace2_data_intmax("midx", the_repository, "load/num_packs", m->num_packs);
169 + trace2_data_intmax("midx", the_repository, "load/num_objects", m->num_objects);
170 +
171 return m;
172
173 cleanup_fail: