Skip to content

Commit dc8019e

Browse files
committed
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 <jeffhost@microsoft.com>
1 parent a495882 commit dc8019e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sha1-file.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ static int read_object_process(const struct object_id *oid)
745745

746746
start = getnanotime();
747747

748+
trace2_region_enter("subprocess", "read_object", the_repository);
749+
748750
if (!subprocess_map_initialized) {
749751
subprocess_map_initialized = 1;
750752
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -761,13 +763,16 @@ static int read_object_process(const struct object_id *oid)
761763
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
762764
start_read_object_fn)) {
763765
free(entry);
764-
return -1;
766+
err = -1;
767+
goto leave_region;
765768
}
766769
}
767770
process = &entry->subprocess.process;
768771

769-
if (!(CAP_GET & entry->supported_capabilities))
770-
return -1;
772+
if (!(CAP_GET & entry->supported_capabilities)) {
773+
err = -1;
774+
goto leave_region;
775+
}
771776

772777
sigchain_push(SIGPIPE, SIG_IGN);
773778

@@ -816,6 +821,10 @@ static int read_object_process(const struct object_id *oid)
816821

817822
trace_performance_since(start, "read_object_process");
818823

824+
leave_region:
825+
trace2_region_leave_printf("subprocess", "read_object", the_repository,
826+
"result %d", err);
827+
819828
return err;
820829
}
821830

0 commit comments

Comments
 (0)