trace2:gvfs:experiment: add unpack_entry() counter to unpack_trees() and report_tracking()

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
Jeff Hostetler 2019-07-16 10:40:56 -04:00 коммит произвёл Derrick Stolee
Родитель 4d7b962b45
Коммит 35c5f87e8b
4 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -14,6 +14,7 @@
#include "lockfile.h"
#include "merge-recursive.h"
#include "object-store.h"
#include "packfile.h"
#include "parse-options.h"
#include "refs.h"
#include "remote.h"
@ -990,8 +991,13 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
strbuf_release(&msg);
if (!opts->quiet &&
(new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, "HEAD")))) {
unsigned long nr_unpack_entry_at_start;
trace2_region_enter("exp", "report_tracking", the_repository);
nr_unpack_entry_at_start = get_nr_unpack_entry();
report_tracking(new_branch_info);
trace2_data_intmax("exp", NULL, "report_tracking/nr_unpack_entries",
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
trace2_region_leave("exp", "report_tracking", the_repository);
}
}

Просмотреть файл

@ -1650,6 +1650,13 @@ struct unpack_entry_stack_ent {
unsigned long size;
};
static unsigned long g_nr_unpack_entry;
unsigned long get_nr_unpack_entry(void)
{
return g_nr_unpack_entry;
}
void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
enum object_type *final_type, unsigned long *final_size)
{
@ -1663,6 +1670,8 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
int delta_stack_nr = 0, delta_stack_alloc = UNPACK_ENTRY_STACK_PREALLOC;
int base_from_cache = 0;
g_nr_unpack_entry++;
write_pack_access_log(p, obj_offset);
/* PHASE 1: drill down to the innermost base object */

Просмотреть файл

@ -195,4 +195,9 @@ int is_promisor_object(const struct object_id *oid);
int load_idx(const char *path, const unsigned int hashsz, void *idx_map,
size_t idx_size, struct packed_git *p);
/*
* Return the number of objects fetched from a packfile.
*/
unsigned long get_nr_unpack_entry(void);
#endif

Просмотреть файл

@ -9,6 +9,7 @@
#include "tree-walk.h"
#include "cache-tree.h"
#include "unpack-trees.h"
#include "packfile.h"
#include "progress.h"
#include "refs.h"
#include "attr.h"
@ -1880,6 +1881,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
struct pattern_list pl;
int free_pattern_list = 0;
struct dir_struct dir = DIR_INIT;
unsigned long nr_unpack_entry_at_start;
if (o->reset == UNPACK_RESET_INVALID)
BUG("o->reset had a value of 1; should be UNPACK_TREES_*_UNTRACKED");
@ -1890,6 +1892,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
BUG("o->dir is for internal use only");
trace2_region_enter("exp", "unpack_trees", NULL);
nr_unpack_entry_at_start = get_nr_unpack_entry();
trace_performance_enter();
trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
@ -2091,6 +2094,8 @@ done:
}
trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
trace_performance_leave("unpack_trees");
trace2_data_intmax("unpack_trees", NULL, "unpack_trees/nr_unpack_entries",
(intmax_t)(get_nr_unpack_entry() - nr_unpack_entry_at_start));
trace2_region_leave("exp", "unpack_trees", NULL);
return ret;