Skip to content

Commit f7476e9

Browse files
jeffhostetlermjcheetham
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 bbff50a commit f7476e9

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
@@ -2564,6 +2564,36 @@ void wt_status_print(struct wt_status *s)
25642564
s->untracked.nr);
25652565
trace2_data_intmax("status", s->repo, "count/ignored", s->ignored.nr);
25662566

2567+
switch (s->state.sparse_checkout_percentage) {
2568+
case SPARSE_CHECKOUT_DISABLED:
2569+
break;
2570+
case SPARSE_CHECKOUT_SPARSE_INDEX:
2571+
/*
2572+
* Log just the observed size of the sparse-index.
2573+
*
2574+
* When sparse-index is enabled we can have
2575+
* sparse-directory entries in addition to individual
2576+
* sparse-file entries, so we don't know the complete
2577+
* size of the index. And we do not want to force
2578+
* expand it just to emit some telemetry data. So we
2579+
* cannot report a percentage for the space savings.
2580+
*
2581+
* It is possible that if the telemetry data is
2582+
* aggregated, someone will have a good estimate for
2583+
* the size of a fully populated index and can compute
2584+
* a percentage after the fact.
2585+
*/
2586+
trace2_data_intmax("status", s->repo,
2587+
"sparse-index/size",
2588+
s->repo->index->cache_nr);
2589+
break;
2590+
default:
2591+
trace2_data_intmax("status", s->repo,
2592+
"sparse-checkout/percentage",
2593+
s->state.sparse_checkout_percentage);
2594+
break;
2595+
}
2596+
25672597
trace2_region_enter("status", "print", s->repo);
25682598

25692599
switch (s->status_format) {

0 commit comments

Comments
 (0)