Class MemoryTrainingListener

  • All Implemented Interfaces:
    TrainingListener

    public class MemoryTrainingListener
    extends TrainingListenerAdapter
    TrainingListener that collects the memory usage information.

    If an outputDir is provided, the file "$outputDir/memory.log" will be created after training with the memory usage results.

    • Constructor Detail

      • MemoryTrainingListener

        public MemoryTrainingListener()
        Constructs a MemoryTrainingListener that does not output data to a file.
      • MemoryTrainingListener

        public MemoryTrainingListener​(java.lang.String outputDir)
        Constructs a MemoryTrainingListener that outputs data in the given directory.

        If an output directory is provided, the file "$outputDir/memory.log" will be created after training with the memory usage results. The log file consists of heap bytes, non-heap bytes, cpu percentage and rss bytes consumption along with the timestamps.

        Parameters:
        outputDir - the directory to output the tracked memory data in
    • Method Detail

      • collectMemoryInfo

        public static void collectMemoryInfo​(Metrics metrics)
        Collects memory information. In order to collect metrics, the Trainer must set metrics. Monitor the metrics by enabling the following flag in the command line arguments: -Dcollect-memory=true
        Parameters:
        metrics - Metrics to store memory information
      • dumpMemoryInfo

        public static void dumpMemoryInfo​(Metrics metrics,
                                          java.lang.String logDir)
        Dump memory metrics into log directory.
        Parameters:
        metrics - metrics contains memory information
        logDir - output log directory