Skip to content

Commit 207b578

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 665e1b4 commit 207b578

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"
@@ -1061,6 +1062,8 @@ static int read_object_process(const struct object_id *oid)
10611062

10621063
start = getnanotime();
10631064

1065+
trace2_region_enter("subprocess", "read_object", the_repository);
1066+
10641067
if (!subprocess_map_initialized) {
10651068
subprocess_map_initialized = 1;
10661069
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -1077,13 +1080,16 @@ static int read_object_process(const struct object_id *oid)
10771080
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
10781081
start_read_object_fn)) {
10791082
free(entry);
1080-
return -1;
1083+
err = -1;
1084+
goto leave_region;
10811085
}
10821086
}
10831087
process = &entry->subprocess.process;
10841088

1085-
if (!(CAP_GET & entry->supported_capabilities))
1086-
return -1;
1089+
if (!(CAP_GET & entry->supported_capabilities)) {
1090+
err = -1;
1091+
goto leave_region;
1092+
}
10871093

10881094
sigchain_push(SIGPIPE, SIG_IGN);
10891095

@@ -1132,6 +1138,10 @@ static int read_object_process(const struct object_id *oid)
11321138

11331139
trace_performance_since(start, "read_object_process");
11341140

1141+
leave_region:
1142+
trace2_region_leave_printf("subprocess", "read_object", the_repository,
1143+
"result %d", err);
1144+
11351145
strbuf_release(&status);
11361146
return err;
11371147
}

0 commit comments

Comments
 (0)