Class SerializationStats
java.lang.Object
com.loomcache.server.serialization.SerializationStats
Statistics tracker for serialization operations.
Tracks: - totalSerialized: Total number of bytes serialized - totalDeserialized: Total number of bytes deserialized - serializationCount: Number of serialization operations - deserializationCount: Number of deserialization operations - avgSerializeSizeBytes: Average size of serialized data - totalErrors: Total serialization/deserialization errors
Thread-safe using atomic counters. Immutable after creation.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongCalculate average deserialization size in bytes.longCalculate average serialization size in bytes.longGet number of deserialization operations.voidrecordDeserialization(long sizeBytes) Record a deserialization operation with the given byte size.voidRecord a serialization error.voidrecordSerialization(long sizeBytes) Record a serialization operation with the given byte size.voidreset()Reset all statistics.longGet number of serialization operations.longGet total bytes deserialized.longGet total errors.longGet total bytes serialized.
-
Constructor Details
-
SerializationStats
public SerializationStats()
-
-
Method Details
-
recordSerialization
public void recordSerialization(long sizeBytes) Record a serialization operation with the given byte size.- Parameters:
sizeBytes- the number of bytes serialized (must be >= 0)- Throws:
IllegalArgumentException- if sizeBytes is negative
-
recordDeserialization
public void recordDeserialization(long sizeBytes) Record a deserialization operation with the given byte size.- Parameters:
sizeBytes- the number of bytes deserialized (must be >= 0)- Throws:
IllegalArgumentException- if sizeBytes is negative
-
recordError
public void recordError()Record a serialization error. -
totalSerialized
public long totalSerialized()Get total bytes serialized. -
totalDeserialized
public long totalDeserialized()Get total bytes deserialized. -
serializationCount
public long serializationCount()Get number of serialization operations. -
deserializationCount
public long deserializationCount()Get number of deserialization operations. -
avgSerializeSizeBytes
public long avgSerializeSizeBytes()Calculate average serialization size in bytes.- Returns:
- the average serialization size, or 0 if no serializations have occurred
-
avgDeserializeSizeBytes
public long avgDeserializeSizeBytes()Calculate average deserialization size in bytes.- Returns:
- the average deserialization size, or 0 if no deserializations have occurred
-
totalErrors
public long totalErrors()Get total errors. -
reset
public void reset()Reset all statistics.
-