Skip to content

Commit

Permalink
[to be squashed] Added getCapacity() and getOccupancy() to ReduceHash…
Browse files Browse the repository at this point in the history
…Table.
  • Loading branch information
aalexandrov committed Mar 28, 2016
1 parent bca84c3 commit 50c9273
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,24 @@ public ReduceHashTable(TypeSerializer<T> serializer, TypeComparator<T> comparato
enableResize = buildSideSerializer.getLength() == -1;
}

/**
* Gets the total capacity of this hash table, in bytes.
*
* @return The hash table's total capacity.
*/
public long getCapacity() {
return numAllMemorySegments * segmentSize;
}

/**
* Gets the number of bytes currently occupied in this hash table.
*
* @return The number of bytes occupied.
*/
public long getOccupancy() {
return numAllMemorySegments * segmentSize - freeMemorySegments.size() * segmentSize;
}

private void open(int numBucketSegments) {
synchronized (stateLock) {
if (!closed) {
Expand Down

0 comments on commit 50c9273

Please sign in to comment.