Skip to content

Commit d3bd23f

Browse files
jeffhostetlermjcheetham
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 51e4b61 commit d3bd23f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

object-file.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "loose.h"
4343
#include "object-file-convert.h"
4444
#include "trace.h"
45+
#include "trace2.h"
4546
#include "hook.h"
4647
#include "sigchain.h"
4748
#include "sub-process.h"
@@ -1078,6 +1079,8 @@ static int read_object_process(const struct object_id *oid)
10781079

10791080
start = getnanotime();
10801081

1082+
trace2_region_enter("subprocess", "read_object", the_repository);
1083+
10811084
if (!subprocess_map_initialized) {
10821085
subprocess_map_initialized = 1;
10831086
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -1094,13 +1097,16 @@ static int read_object_process(const struct object_id *oid)
10941097
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
10951098
start_read_object_fn)) {
10961099
free(entry);
1097-
return -1;
1100+
err = -1;
1101+
goto leave_region;
10981102
}
10991103
}
11001104
process = &entry->subprocess.process;
11011105

1102-
if (!(CAP_GET & entry->supported_capabilities))
1103-
return -1;
1106+
if (!(CAP_GET & entry->supported_capabilities)) {
1107+
err = -1;
1108+
goto leave_region;
1109+
}
11041110

11051111
sigchain_push(SIGPIPE, SIG_IGN);
11061112

@@ -1149,6 +1155,10 @@ static int read_object_process(const struct object_id *oid)
11491155

11501156
trace_performance_since(start, "read_object_process");
11511157

1158+
leave_region:
1159+
trace2_region_leave_printf("subprocess", "read_object", the_repository,
1160+
"result %d", err);
1161+
11521162
strbuf_release(&status);
11531163
return err;
11541164
}

0 commit comments

Comments
 (0)