Class FieldMemoryStats

  • All Implemented Interfaces:
    java.lang.Iterable<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>, Writeable

    public final class FieldMemoryStats
    extends java.lang.Object
    implements Writeable, java.lang.Iterable<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>
    A reusable class to encode field -&gt; memory size mappings
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldMemoryStats​(com.carrotsearch.hppc.ObjectLongHashMap<java.lang.String> stats)
      Creates a new FieldMemoryStats instance
      FieldMemoryStats​(StreamInput input)
      Creates a new FieldMemoryStats instance from a stream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(FieldMemoryStats fieldMemoryStats)
      Adds / merges the given field memory stats into this stats instance
      boolean containsField​(java.lang.String field)
      Returns true iff the given field is in the stats
      FieldMemoryStats copy()
      Creates a deep copy of this stats instance
      boolean equals​(java.lang.Object o)  
      long get​(java.lang.String field)
      Returns the fields value in bytes or 0 if it's not present in the stats
      int hashCode()  
      java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>> iterator()  
      void toXContent​(XContentBuilder builder, java.lang.String key, java.lang.String rawKey, java.lang.String readableKey)
      Generates x-content into the given builder for each of the fields in this stats instance
      void writeTo​(StreamOutput out)
      Write this into the StreamOutput.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • FieldMemoryStats

        public FieldMemoryStats​(com.carrotsearch.hppc.ObjectLongHashMap<java.lang.String> stats)
        Creates a new FieldMemoryStats instance
      • FieldMemoryStats

        public FieldMemoryStats​(StreamInput input)
                         throws java.io.IOException
        Creates a new FieldMemoryStats instance from a stream
        Throws:
        java.io.IOException
    • Method Detail

      • add

        public void add​(FieldMemoryStats fieldMemoryStats)
        Adds / merges the given field memory stats into this stats instance
      • toXContent

        public void toXContent​(XContentBuilder builder,
                               java.lang.String key,
                               java.lang.String rawKey,
                               java.lang.String readableKey)
                        throws java.io.IOException
        Generates x-content into the given builder for each of the fields in this stats instance
        Parameters:
        builder - the builder to generated on
        key - the top level key for this stats object
        rawKey - the raw byte key for each of the fields byte sizes
        readableKey - the readable key for each of the fields byte sizes
        Throws:
        java.io.IOException
      • copy

        public FieldMemoryStats copy()
        Creates a deep copy of this stats instance
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • iterator

        public java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<com.carrotsearch.hppc.cursors.ObjectLongCursor<java.lang.String>>
      • get

        public long get​(java.lang.String field)
        Returns the fields value in bytes or 0 if it's not present in the stats
      • containsField

        public boolean containsField​(java.lang.String field)
        Returns true iff the given field is in the stats