Class StatsWriter
- java.lang.Object
-
- com.amazonaws.kinesisvideo.demoapp.debug.StatsWriter
-
- All Implemented Interfaces:
AutoCloseable
public class StatsWriter extends Object implements AutoCloseable
Writes the current heap memory count to the file (bytes), along with a timestamp. This class provides a way to monitor memory allocation of a KinesisVideoClient by periodically writing the allocation size to a specified file in a csv-format.This class will spawn a new thread to record the metrics, and terminate that thread once
close()is called.
-
-
Constructor Summary
Constructors Constructor Description StatsWriter(String filePath, Duration pollingIntervalMs, NativeKinesisVideoClient kinesisVideoClient)Creates a new HeapWriter instance.
-
-
-
Constructor Detail
-
StatsWriter
public StatsWriter(@Nonnull String filePath, @Nonnull Duration pollingIntervalMs, @Nonnull NativeKinesisVideoClient kinesisVideoClient) throws IOException
Creates a new HeapWriter instance.- Parameters:
filePath- The path to the file where heap information will be writtenpollingIntervalMs- The interval in milliseconds between heap measurementskinesisVideoClient- The KinesisVideoClient instance to monitor- Throws:
IOException- If there's an error creating or opening the output file
-
-
Method Detail
-
close
public void close()
Stops the monitoring and closes all resources.- Specified by:
closein interfaceAutoCloseable
-
-