Skip to content

Commit aff9def

Browse files
jeffhostetlerdscho
authored andcommitted
trace2:gvfs:experiment: add unpack_entry() counter to unpack_trees() and report_tracking()
Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b31529b commit aff9def

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

builtin/checkout.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "merge-recursive.h"
2121
#include "object-name.h"
2222
#include "object-store-ll.h"
23+
#include "packfile.h"
2324
#include "parse-options.h"
2425
#include "path.h"
2526
#include "preload-index.h"
@@ -1050,8 +1051,13 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
10501051
if (!opts->quiet &&
10511052
!opts->force_detach &&
10521053
(new_branch_info->path || !strcmp(new_branch_info->name, "HEAD"))) {
1054+
unsigned long nr_unpack_entry_at_start;
1055+
10531056
trace2_region_enter("exp", "report_tracking", the_repository);
1057+
nr_unpack_entry_at_start = get_nr_unpack_entry();
10541058
report_tracking(new_branch_info);
1059+
trace2_data_intmax("exp", NULL, "report_tracking/nr_unpack_entries",
1060+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
10551061
trace2_region_leave("exp", "report_tracking", the_repository);
10561062
}
10571063
}

packfile.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,13 @@ struct unpack_entry_stack_ent {
16951695
unsigned long size;
16961696
};
16971697

1698+
static unsigned long g_nr_unpack_entry;
1699+
1700+
unsigned long get_nr_unpack_entry(void)
1701+
{
1702+
return g_nr_unpack_entry;
1703+
}
1704+
16981705
void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
16991706
enum object_type *final_type, unsigned long *final_size)
17001707
{
@@ -1708,6 +1715,8 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
17081715
int delta_stack_nr = 0, delta_stack_alloc = UNPACK_ENTRY_STACK_PREALLOC;
17091716
int base_from_cache = 0;
17101717

1718+
g_nr_unpack_entry++;
1719+
17111720
prepare_repo_settings(p->repo);
17121721

17131722
write_pack_access_log(p, obj_offset);

packfile.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,9 @@ int load_idx(const char *path, const unsigned int hashsz, void *idx_map,
222222
*/
223223
int parse_pack_header_option(const char *in, unsigned char *out, unsigned int *len);
224224

225+
/*
226+
* Return the number of objects fetched from a packfile.
227+
*/
228+
unsigned long get_nr_unpack_entry(void);
229+
225230
#endif

unpack-trees.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "tree-walk.h"
1818
#include "cache-tree.h"
1919
#include "unpack-trees.h"
20+
#include "packfile.h"
2021
#include "progress.h"
2122
#include "refs.h"
2223
#include "attr.h"
@@ -1901,6 +1902,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19011902
struct pattern_list pl;
19021903
int free_pattern_list = 0;
19031904
struct dir_struct dir = DIR_INIT;
1905+
unsigned long nr_unpack_entry_at_start;
19041906

19051907
if (o->reset == UNPACK_RESET_INVALID)
19061908
BUG("o->reset had a value of 1; should be UNPACK_TREES_*_UNTRACKED");
@@ -1915,6 +1917,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19151917
BUG("o->df_conflict_entry is an output only field");
19161918

19171919
trace2_region_enter("exp", "unpack_trees", NULL);
1920+
nr_unpack_entry_at_start = get_nr_unpack_entry();
19181921

19191922
trace_performance_enter();
19201923
trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
@@ -2125,6 +2128,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
21252128
}
21262129
trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
21272130
trace_performance_leave("unpack_trees");
2131+
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
2132+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
21282133
trace2_region_leave("exp", "unpack_trees", NULL);
21292134
return ret;
21302135

0 commit comments

Comments
 (0)