Class MemoryLogger


  • public class MemoryLogger
    extends java.lang.Object
    This class is used to record the maximum memory usaged of an algorithm during a given execution. It is implemented by using the "singleton" design pattern.
    • Constructor Summary

      Constructors 
      Constructor Description
      MemoryLogger()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkMemory()
      Check the current memory usage and record it if it is higher than the amount of memory previously recorded.
      static MemoryLogger getInstance()
      Method to obtain the only instance of this class
      double getMaxMemory()
      To get the maximum amount of memory used until now
      void reset()
      Reset the maximum amount of memory recorded.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MemoryLogger

        public MemoryLogger()
    • Method Detail

      • getInstance

        public static MemoryLogger getInstance()
        Method to obtain the only instance of this class
        Returns:
        instance of MemoryLogger
      • getMaxMemory

        public double getMaxMemory()
        To get the maximum amount of memory used until now
        Returns:
        a double value indicating memory as megabytes
      • reset

        public void reset()
        Reset the maximum amount of memory recorded.
      • checkMemory

        public void checkMemory()
        Check the current memory usage and record it if it is higher than the amount of memory previously recorded.