Skip to content

Commit 641b94d

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 e953eb7 commit 641b94d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

odb.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "submodule.h"
3030
#include "trace2.h"
3131
#include "trace.h"
32+
#include "trace2.h"
3233
#include "write-or-die.h"
3334

3435
KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
@@ -648,6 +649,8 @@ int read_object_process(struct repository *r, const struct object_id *oid)
648649

649650
start = getnanotime();
650651

652+
trace2_region_enter("subprocess", "read_object",r);
653+
651654
if (!subprocess_map_initialized) {
652655
subprocess_map_initialized = 1;
653656
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -664,13 +667,16 @@ int read_object_process(struct repository *r, const struct object_id *oid)
664667
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
665668
start_read_object_fn)) {
666669
free(entry);
667-
return -1;
670+
err = -1;
671+
goto leave_region;
668672
}
669673
}
670674
process = &entry->subprocess.process;
671675

672-
if (!(CAP_GET & entry->supported_capabilities))
673-
return -1;
676+
if (!(CAP_GET & entry->supported_capabilities)) {
677+
err = -1;
678+
goto leave_region;
679+
}
674680

675681
sigchain_push(SIGPIPE, SIG_IGN);
676682

@@ -719,6 +725,10 @@ int read_object_process(struct repository *r, const struct object_id *oid)
719725

720726
trace_performance_since(start, "read_object_process");
721727

728+
leave_region:
729+
trace2_region_leave_printf("subprocess", "read_object", r,
730+
"result %d", err);
731+
722732
strbuf_release(&status);
723733
return err;
724734
}

0 commit comments

Comments
 (0)