Skip to content

Commit c15f0c6

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>
1 parent 244e6f2 commit c15f0c6

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
@@ -19,6 +19,7 @@
1919
#include "merge-recursive.h"
2020
#include "object-name.h"
2121
#include "object-store-ll.h"
22+
#include "packfile.h"
2223
#include "parse-options.h"
2324
#include "path.h"
2425
#include "preload-index.h"
@@ -1019,8 +1020,13 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
10191020
strbuf_release(&msg);
10201021
if (!opts->quiet &&
10211022
(new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, "HEAD")))) {
1023+
unsigned long nr_unpack_entry_at_start;
1024+
10221025
trace2_region_enter("exp", "report_tracking", the_repository);
1026+
nr_unpack_entry_at_start = get_nr_unpack_entry();
10231027
report_tracking(new_branch_info);
1028+
trace2_data_intmax("exp", NULL, "report_tracking/nr_unpack_entries",
1029+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
10241030
trace2_region_leave("exp", "report_tracking", the_repository);
10251031
}
10261032
}

packfile.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,13 @@ struct unpack_entry_stack_ent {
16661666
unsigned long size;
16671667
};
16681668

1669+
static unsigned long g_nr_unpack_entry;
1670+
1671+
unsigned long get_nr_unpack_entry(void)
1672+
{
1673+
return g_nr_unpack_entry;
1674+
}
1675+
16691676
void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
16701677
enum object_type *final_type, unsigned long *final_size)
16711678
{
@@ -1679,6 +1686,8 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
16791686
int delta_stack_nr = 0, delta_stack_alloc = UNPACK_ENTRY_STACK_PREALLOC;
16801687
int base_from_cache = 0;
16811688

1689+
g_nr_unpack_entry++;
1690+
16821691
write_pack_access_log(p, obj_offset);
16831692

16841693
/* PHASE 1: drill down to the innermost base object */

packfile.h

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

211+
/*
212+
* Return the number of objects fetched from a packfile.
213+
*/
214+
unsigned long get_nr_unpack_entry(void);
215+
211216
#endif

unpack-trees.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "tree-walk.h"
1515
#include "cache-tree.h"
1616
#include "unpack-trees.h"
17+
#include "packfile.h"
1718
#include "progress.h"
1819
#include "refs.h"
1920
#include "attr.h"
@@ -1890,6 +1891,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
18901891
struct pattern_list pl;
18911892
int free_pattern_list = 0;
18921893
struct dir_struct dir = DIR_INIT;
1894+
unsigned long nr_unpack_entry_at_start;
18931895

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

19061908
trace2_region_enter("exp", "unpack_trees", NULL);
1909+
nr_unpack_entry_at_start = get_nr_unpack_entry();
19071910

19081911
trace_performance_enter();
19091912
trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
@@ -2109,6 +2112,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
21092112
}
21102113
trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
21112114
trace_performance_leave("unpack_trees");
2115+
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
2116+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
21122117
trace2_region_leave("exp", "unpack_trees", NULL);
21132118
return ret;
21142119

0 commit comments

Comments
 (0)