Skip to content

Commit 96ff347

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 <jeffhost@microsoft.com>
1 parent 6d630b5 commit 96ff347

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
@@ -41,6 +41,7 @@
4141
#include "loose.h"
4242
#include "object-file-convert.h"
4343
#include "trace.h"
44+
#include "trace2.h"
4445
#include "hook.h"
4546
#include "sigchain.h"
4647
#include "sub-process.h"
@@ -1060,6 +1061,8 @@ static int read_object_process(const struct object_id *oid)
10601061

10611062
start = getnanotime();
10621063

1064+
trace2_region_enter("subprocess", "read_object", the_repository);
1065+
10631066
if (!subprocess_map_initialized) {
10641067
subprocess_map_initialized = 1;
10651068
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -1076,13 +1079,16 @@ static int read_object_process(const struct object_id *oid)
10761079
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
10771080
start_read_object_fn)) {
10781081
free(entry);
1079-
return -1;
1082+
err = -1;
1083+
goto leave_region;
10801084
}
10811085
}
10821086
process = &entry->subprocess.process;
10831087

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

10871093
sigchain_push(SIGPIPE, SIG_IGN);
10881094

@@ -1131,6 +1137,10 @@ static int read_object_process(const struct object_id *oid)
11311137

11321138
trace_performance_since(start, "read_object_process");
11331139

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

0 commit comments

Comments
 (0)