Skip to content

Commit 419f494

Browse files
jeffhostetlerdscho
authored andcommitted
trace2:gvfs:experiment: add unpack_entry() counter to unpack_trees() and report_tracking()
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent edd5e72 commit 419f494

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
@@ -18,6 +18,7 @@
1818
#include "merge-recursive.h"
1919
#include "object-name.h"
2020
#include "object-store-ll.h"
21+
#include "packfile.h"
2122
#include "parse-options.h"
2223
#include "path.h"
2324
#include "preload-index.h"
@@ -1048,8 +1049,13 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
10481049
if (!opts->quiet &&
10491050
!opts->force_detach &&
10501051
(new_branch_info->path || !strcmp(new_branch_info->name, "HEAD"))) {
1052+
unsigned long nr_unpack_entry_at_start;
1053+
10511054
trace2_region_enter("exp", "report_tracking", the_repository);
1055+
nr_unpack_entry_at_start = get_nr_unpack_entry();
10521056
report_tracking(new_branch_info);
1057+
trace2_data_intmax("exp", NULL, "report_tracking/nr_unpack_entries",
1058+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
10531059
trace2_region_leave("exp", "report_tracking", the_repository);
10541060
}
10551061
}

packfile.c

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

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

1717+
g_nr_unpack_entry++;
1718+
17101719
prepare_repo_settings(p->repo);
17111720

17121721
write_pack_access_log(p, obj_offset);

packfile.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,9 @@ int is_promisor_object(struct repository *r, const struct object_id *oid);
216216
int load_idx(const char *path, const unsigned int hashsz, void *idx_map,
217217
size_t idx_size, struct packed_git *p);
218218

219+
/*
220+
* Return the number of objects fetched from a packfile.
221+
*/
222+
unsigned long get_nr_unpack_entry(void);
223+
219224
#endif

unpack-trees.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "tree-walk.h"
1717
#include "cache-tree.h"
1818
#include "unpack-trees.h"
19+
#include "packfile.h"
1920
#include "progress.h"
2021
#include "refs.h"
2122
#include "attr.h"
@@ -1900,6 +1901,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19001901
struct pattern_list pl;
19011902
int free_pattern_list = 0;
19021903
struct dir_struct dir = DIR_INIT;
1904+
unsigned long nr_unpack_entry_at_start;
19031905

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

19161918
trace2_region_enter("exp", "unpack_trees", NULL);
1919+
nr_unpack_entry_at_start = get_nr_unpack_entry();
19171920

19181921
trace_performance_enter();
19191922
trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
@@ -2124,6 +2127,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
21242127
}
21252128
trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
21262129
trace_performance_leave("unpack_trees");
2130+
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
2131+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
21272132
trace2_region_leave("exp", "unpack_trees", NULL);
21282133
return ret;
21292134

0 commit comments

Comments
 (0)