Skip to content

Commit

Permalink
Add full block span count and len metrics to rowset. (#1743)
Browse files Browse the repository at this point in the history
* Add full block span count and len metrics to rsp.

* Spotlessfy.

Co-authored-by: Cristian Ferretti <jcferretti@users.noreply.github.com>
  • Loading branch information
jcferretti and jcferretti authored Dec 28, 2021
1 parent 33d5348 commit 8739824
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
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

0 comments on commit 8739824

Please sign in to comment.