Skip to content

Commit e4c6179

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 c297695 commit e4c6179

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎odb.c‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "tmp-objdir.h"
3333
#include "trace2.h"
3434
#include "trace.h"
35+
#include "trace2.h"
3536
#include "write-or-die.h"
3637

3738
KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
@@ -679,6 +680,8 @@ int read_object_process(struct repository *r, const struct object_id *oid)
679680

680681
start = getnanotime();
681682

683+
trace2_region_enter("subprocess", "read_object",r);
684+
682685
if (!subprocess_map_initialized) {
683686
subprocess_map_initialized = 1;
684687
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -695,13 +698,16 @@ int read_object_process(struct repository *r, const struct object_id *oid)
695698
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
696699
start_read_object_fn)) {
697700
free(entry);
698-
return -1;
701+
err = -1;
702+
goto leave_region;
699703
}
700704
}
701705
process = &entry->subprocess.process;
702706

703-
if (!(CAP_GET & entry->supported_capabilities))
704-
return -1;
707+
if (!(CAP_GET & entry->supported_capabilities)) {
708+
err = -1;
709+
goto leave_region;
710+
}
705711

706712
sigchain_push(SIGPIPE, SIG_IGN);
707713

@@ -750,6 +756,10 @@ int read_object_process(struct repository *r, const struct object_id *oid)
750756

751757
trace_performance_since(start, "read_object_process");
752758

759+
leave_region:
760+
trace2_region_leave_printf("subprocess", "read_object", r,
761+
"result %d", err);
762+
753763
strbuf_release(&status);
754764
return err;
755765
}

0 commit comments

Comments
 (0)