Skip to content

Commit 729d7f7

Browse files
jeffhostetlerdscho
authored andcommitted
gvfs:trace2:data: add trace2 tracing around read_object_process
Add trace2 region around read_object_process to collect time spent waiting for missing objects to be dynamically fetched. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 8f9cecf commit 729d7f7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

odb.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "submodule.h"
3030
#include "trace2.h"
3131
#include "trace.h"
32+
#include "trace2.h"
3233
#include "write-or-die.h"
3334

3435
KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
@@ -651,6 +652,8 @@ int read_object_process(struct repository *r, const struct object_id *oid)
651652

652653
start = getnanotime();
653654

655+
trace2_region_enter("subprocess", "read_object",r);
656+
654657
if (!subprocess_map_initialized) {
655658
subprocess_map_initialized = 1;
656659
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -667,13 +670,16 @@ int read_object_process(struct repository *r, const struct object_id *oid)
667670
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
668671
start_read_object_fn)) {
669672
free(entry);
670-
return -1;
673+
err = -1;
674+
goto leave_region;
671675
}
672676
}
673677
process = &entry->subprocess.process;
674678

675-
if (!(CAP_GET & entry->supported_capabilities))
676-
return -1;
679+
if (!(CAP_GET & entry->supported_capabilities)) {
680+
err = -1;
681+
goto leave_region;
682+
}
677683

678684
sigchain_push(SIGPIPE, SIG_IGN);
679685

@@ -722,6 +728,10 @@ int read_object_process(struct repository *r, const struct object_id *oid)
722728

723729
trace_performance_since(start, "read_object_process");
724730

731+
leave_region:
732+
trace2_region_leave_printf("subprocess", "read_object", r,
733+
"result %d", err);
734+
725735
strbuf_release(&status);
726736
return err;
727737
}

0 commit comments

Comments
 (0)