Skip to content

Commit 2063428

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 6a7c558 commit 2063428

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
@@ -44,6 +44,7 @@
4444
#include "submodule.h"
4545
#include "fsck.h"
4646
#include "trace.h"
47+
#include "trace2.h"
4748
#include "hook.h"
4849
#include "sigchain.h"
4950
#include "sub-process.h"
@@ -999,6 +1000,8 @@ static int read_object_process(const struct object_id *oid)
9991000

10001001
start = getnanotime();
10011002

1003+
trace2_region_enter("subprocess", "read_object", the_repository);
1004+
10021005
if (!subprocess_map_initialized) {
10031006
subprocess_map_initialized = 1;
10041007
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -1015,13 +1018,16 @@ static int read_object_process(const struct object_id *oid)
10151018
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
10161019
start_read_object_fn)) {
10171020
free(entry);
1018-
return -1;
1021+
err = -1;
1022+
goto leave_region;
10191023
}
10201024
}
10211025
process = &entry->subprocess.process;
10221026

1023-
if (!(CAP_GET & entry->supported_capabilities))
1024-
return -1;
1027+
if (!(CAP_GET & entry->supported_capabilities)) {
1028+
err = -1;
1029+
goto leave_region;
1030+
}
10251031

10261032
sigchain_push(SIGPIPE, SIG_IGN);
10271033

@@ -1070,6 +1076,10 @@ static int read_object_process(const struct object_id *oid)
10701076

10711077
trace_performance_since(start, "read_object_process");
10721078

1079+
leave_region:
1080+
trace2_region_leave_printf("subprocess", "read_object", the_repository,
1081+
"result %d", err);
1082+
10731083
return err;
10741084
}
10751085

0 commit comments

Comments
 (0)