Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full block span count and len metrics to rowset. #1743

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public final class RowSetCounts {
public final LongCounterMetric rspTwoValuesContainerCount;
public final LongCounterMetric rspSingletonContainersCount;

public final LongCounterLog2HistogramMetric rspFullBlockSpansCount;
public final LongCounterLog2HistogramMetric rspFullBlockSpansLen;

public RowSetCounts(final String prefix) {
emptyCount =
new IntCounterMetric(prefix + "EmptyCount");
Expand Down Expand Up @@ -121,6 +124,11 @@ public RowSetCounts(final String prefix) {

rspSingletonContainersCount =
new LongCounterMetric(prefix + "RspSingletonContainersCount");

rspFullBlockSpansCount =
new LongCounterLog2HistogramMetric(prefix + "RspFullBlockSpansCount");
rspFullBlockSpansLen =
new LongCounterLog2HistogramMetric(prefix + "RspFullBlockSpansLen");
}

public void sampleRsp(final RspBitmap rb) {
Expand Down Expand Up @@ -148,7 +156,9 @@ public void sampleRsp(final RspBitmap rb) {
rspSingleRangeContainersCount,
rspSingleRangeContainerCardinality,
rspSingletonContainersCount,
rspTwoValuesContainerCount);
rspTwoValuesContainerCount,
rspFullBlockSpansCount,
rspFullBlockSpansLen);
}

public void sampleSingleRange(final SingleRange sr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4824,11 +4824,15 @@ public void sampleMetrics(
final LongConsumer singleRangeContainersCount,
final LongConsumer singleRangeContainerCardinality,
final LongConsumer singletonContainersCount,
final LongConsumer twoValuesContainerCount) {
final LongConsumer twoValuesContainerCount,
final LongConsumer fullBlockSpansCount,
final LongConsumer fullBlockSpansLen) {
rspParallelArraysSizeUsed.accept(size);
rspParallelArraysSizeUnused.accept(spanInfos.length - size);
// TODO: It would be much more efficient to accumulate multiple samples (perhaps one array of them per Metric),
// and then provide them to the metric in one call, to prevent multiple volatile assignments.
long fullBlockSpansCountAcc = 0;
long fullBlockSpansLenAcc = 0;
for (int i = 0; i < size; ++i) {
final Object o = spans[i];
if (isSingletonSpan(o)) {
Expand All @@ -4844,7 +4848,9 @@ public void sampleMetrics(
arrayContainersBytesUnused.accept(allocated - card);
continue;
}
if (!(o instanceof Container)) {
if (!(o instanceof Container)) { // full block span
++fullBlockSpansCountAcc;
fullBlockSpansLenAcc += getFullBlockSpanLen(spanInfos[i], o);
continue;
}
final Container c = (Container) o;
Expand Down Expand Up @@ -4876,6 +4882,8 @@ public void sampleMetrics(
throw new IllegalStateException("unknown Container subtype");
}
}
fullBlockSpansCount.accept(fullBlockSpansCountAcc);
fullBlockSpansLen.accept(fullBlockSpansLenAcc);
}

// Returns null if we can't compact.
Expand Down