Java Code Examples for org.apache.lucene.util.RamUsageEstimator#humanReadableUnits()

The following examples show how to use org.apache.lucene.util.RamUsageEstimator#humanReadableUnits() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UninvertingReader.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/** 
 * Return information about the backing cache
 * @lucene.internal 
 */
public static FieldCacheStats getUninvertedStats() {
  CacheEntry[] entries = FieldCache.DEFAULT.getCacheEntries();
  long totalBytesUsed = 0;
  String[] info = new String[entries.length];
  for (int i = 0; i < entries.length; i++) {
    info[i] = entries[i].toString();
    totalBytesUsed += entries[i].getValue().ramBytesUsed();
  }
  String totalSize = RamUsageEstimator.humanReadableUnits(totalBytesUsed);
  return new FieldCacheStats(totalSize, info);
}
 
Example 2
Source File: SortedIntDocSet.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
  return "SortedIntDocSet{" +
      "size=" + size() + "," +
      "ramUsed=" + RamUsageEstimator.humanReadableUnits(ramBytesUsed())+
      '}';
}
 
Example 3
Source File: BitDocSet.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
  return "BitDocSet{" +
      "size=" + size() +
      ",ramUsed=" + RamUsageEstimator.humanReadableUnits(ramBytesUsed()) +
      '}';
}
 
Example 4
Source File: FieldCache.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
/**
 * The most recently estimated size of the value, null unless 
 * estimateSize has been called.
 */
public String getEstimatedSize() {
  long bytesUsed = value == null ? 0L : value.ramBytesUsed();
  return RamUsageEstimator.humanReadableUnits(bytesUsed);
}