From 792bae8b26c7357196e0824e67b27a28b75c288f Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Fri, 12 Jul 2013 21:44:11 +0000 Subject: [PATCH] LUCENE-5094: add ramBytesUsed to OrdinalMap git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1502697 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 5 +++++ .../java/org/apache/lucene/index/MultiDocValues.java | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 8fe4219a12d..7736c778374 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -57,6 +57,11 @@ New features * LUCENE-5098: New broadword utility methods in oal.util.BroadWord. (Paul Elschot via Adrien Grand, Dawid Weiss) +API Changes + +* LUCENE-5094: Add ramBytesUsed() to MultiDocValues.OrdinalMap. + (Robert Muir) + ======================= Lucene 4.4.0 ======================= Changes in backwards compatibility policy diff --git a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java index adc749ab6bb..c793516c802 100644 --- a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java +++ b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java @@ -360,6 +360,17 @@ public class MultiDocValues { public long getValueCount() { return globalOrdDeltas.size(); } + + /** + * Returns total byte size used by this ordinal map. + */ + public long ramBytesUsed() { + long size = globalOrdDeltas.ramBytesUsed() + subIndexes.ramBytesUsed(); + for (int i = 0; i < ordDeltas.length; i++) { + size += ordDeltas[i].ramBytesUsed(); + } + return size; + } } /**