Skip to content

Commit 81ab88c

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 2235cda commit 81ab88c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

object-file.c

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

978978
start = getnanotime();
979979

980+
trace2_region_enter("subprocess", "read_object", the_repository);
981+
980982
if (!subprocess_map_initialized) {
981983
subprocess_map_initialized = 1;
982984
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -993,13 +995,16 @@ static int read_object_process(const struct object_id *oid)
993995
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
994996
start_read_object_fn)) {
995997
free(entry);
996-
return -1;
998+
err = -1;
999+
goto leave_region;
9971000
}
9981001
}
9991002
process = &entry->subprocess.process;
10001003

1001-
if (!(CAP_GET & entry->supported_capabilities))
1002-
return -1;
1004+
if (!(CAP_GET & entry->supported_capabilities)) {
1005+
err = -1;
1006+
goto leave_region;
1007+
}
10031008

10041009
sigchain_push(SIGPIPE, SIG_IGN);
10051010

@@ -1048,6 +1053,10 @@ static int read_object_process(const struct object_id *oid)
10481053

10491054
trace_performance_since(start, "read_object_process");
10501055

1056+
leave_region:
1057+
trace2_region_leave_printf("subprocess", "read_object", the_repository,
1058+
"result %d", err);
1059+
10511060
return err;
10521061
}
10531062

0 commit comments

Comments
 (0)