Skip to content

Commit 7e3ef6a

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 7af9c14 commit 7e3ef6a

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
@@ -21,6 +21,7 @@
2121
#include "object-file.h"
2222
#include "object-name.h"
2323
#include "odb.h"
24+
#include "packfile.h"
2425
#include "parse-options.h"
2526
#include "path.h"
2627
#include "preload-index.h"
@@ -1062,8 +1063,13 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
10621063
if (!opts->quiet &&
10631064
!opts->force_detach &&
10641065
(new_branch_info->path || !strcmp(new_branch_info->name, "HEAD"))) {
1066+
unsigned long nr_unpack_entry_at_start;
1067+
10651068
trace2_region_enter("exp", "report_tracking", the_repository);
1069+
nr_unpack_entry_at_start = get_nr_unpack_entry();
10661070
report_tracking(new_branch_info);
1071+
trace2_data_intmax("exp", NULL, "report_tracking/nr_unpack_entries",
1072+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
10671073
trace2_region_leave("exp", "report_tracking", the_repository);
10681074
}
10691075
}

packfile.c

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

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

1716+
g_nr_unpack_entry++;
1717+
17091718
prepare_repo_settings(p->repo);
17101719

17111720
write_pack_access_log(p, obj_offset);

packfile.h

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

302+
/*
303+
* Return the number of objects fetched from a packfile.
304+
*/
305+
unsigned long get_nr_unpack_entry(void);
306+
302307
#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"
@@ -1903,6 +1904,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
19031904
struct pattern_list pl;
19041905
int free_pattern_list = 0;
19051906
struct dir_struct dir = DIR_INIT;
1907+
unsigned long nr_unpack_entry_at_start;
19061908

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

19191921
trace2_region_enter("exp", "unpack_trees", NULL);
1922+
nr_unpack_entry_at_start = get_nr_unpack_entry();
19201923

19211924
trace_performance_enter();
19221925
trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
@@ -2127,6 +2130,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
21272130
}
21282131
trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
21292132
trace_performance_leave("unpack_trees");
2133+
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
2134+
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
21302135
trace2_region_leave("exp", "unpack_trees", NULL);
21312136
return ret;
21322137

0 commit comments

Comments
 (0)