Skip to content

Commit 295c0df

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 bf25c76 commit 295c0df

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

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

25702600
switch (s->status_format) {

0 commit comments

Comments
 (0)