Skip to content

Commit 00a4dfe

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 <jeffhostetler@github.com>
1 parent b13dd3d commit 00a4dfe

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

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

25742604
switch (s->status_format) {

0 commit comments

Comments
 (0)