Skip to content

Commit 3019a43

Browse files
jeffhostetlerdscho
authored andcommitted
wt-status: add trace2 data for sparse-checkout percentage
When sparse-checkout is enabled, add the sparse-checkout percentage to the Trace2 data stream. This number was already computed and printed on the console in the "You are in a sparse checkout..." message. It would be helpful to log it too for performance monitoring. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent b063dec commit 3019a43

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

wt-status.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,6 +2580,36 @@ void wt_status_print(struct wt_status *s)
25802580
s->untracked.nr);
25812581
trace2_data_intmax("status", s->repo, "count/ignored", s->ignored.nr);
25822582

2583+
switch (s->state.sparse_checkout_percentage) {
2584+
case SPARSE_CHECKOUT_DISABLED:
2585+
break;
2586+
case SPARSE_CHECKOUT_SPARSE_INDEX:
2587+
/*
2588+
* Log just the observed size of the sparse-index.
2589+
*
2590+
* When sparse-index is enabled we can have
2591+
* sparse-directory entries in addition to individual
2592+
* sparse-file entries, so we don't know the complete
2593+
* size of the index. And we do not want to force
2594+
* expand it just to emit some telemetry data. So we
2595+
* cannot report a percentage for the space savings.
2596+
*
2597+
* It is possible that if the telemetry data is
2598+
* aggregated, someone will have a good estimate for
2599+
* the size of a fully populated index and can compute
2600+
* a percentage after the fact.
2601+
*/
2602+
trace2_data_intmax("status", s->repo,
2603+
"sparse-index/size",
2604+
s->repo->index->cache_nr);
2605+
break;
2606+
default:
2607+
trace2_data_intmax("status", s->repo,
2608+
"sparse-checkout/percentage",
2609+
s->state.sparse_checkout_percentage);
2610+
break;
2611+
}
2612+
25832613
trace2_region_enter("status", "print", s->repo);
25842614

25852615
switch (s->status_format) {

0 commit comments

Comments
 (0)