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 mjcheetham committed Jul 29, 2024
1 parent 9a4b9e9 commit e665d87
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 @@ -41,6 +41,7 @@
#include "loose.h"
#include "object-file-convert.h"
#include "trace.h"
#include "trace2.h"
#include "hook.h"
#include "sigchain.h"
#include "sub-process.h"
Expand Down Expand Up @@ -990,6 +991,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 @@ -1006,13 +1009,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 @@ -1061,6 +1067,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 e665d87

Please sign in to comment.