Skip to content

Commit

Permalink
gvfs:trace2:data: add trace2 tracing around read_object_process
Browse files Browse the repository at this point in the history
Add trace2 region around read_object_process to collect
time spent waiting for missing objects to be dynamically
fetched.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
  • Loading branch information
jeffhostetler authored and dscho committed Aug 8, 2023
1 parent f3c28b9 commit 7fe52a0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions object-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "submodule.h"
#include "fsck.h"
#include "trace.h"
#include "trace2.h"
#include "hook.h"
#include "sigchain.h"
#include "sub-process.h"
Expand Down Expand Up @@ -999,6 +1000,8 @@ static int read_object_process(const struct object_id *oid)

start = getnanotime();

trace2_region_enter("subprocess", "read_object", the_repository);

if (!subprocess_map_initialized) {
subprocess_map_initialized = 1;
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
Expand All @@ -1015,13 +1018,16 @@ static int read_object_process(const struct object_id *oid)
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
start_read_object_fn)) {
free(entry);
return -1;
err = -1;
goto leave_region;
}
}
process = &entry->subprocess.process;

if (!(CAP_GET & entry->supported_capabilities))
return -1;
if (!(CAP_GET & entry->supported_capabilities)) {
err = -1;
goto leave_region;
}

sigchain_push(SIGPIPE, SIG_IGN);

Expand Down Expand Up @@ -1070,6 +1076,10 @@ static int read_object_process(const struct object_id *oid)

trace_performance_since(start, "read_object_process");

leave_region:
trace2_region_leave_printf("subprocess", "read_object", the_repository,
"result %d", err);

return err;
}

Expand Down

0 comments on commit 7fe52a0

Please sign in to comment.