ClassLoaderStats class
Statistics and metrics for ClassLoader cache performance monitoring.
Provides comprehensive insights into cache behavior, memory usage, and performance characteristics to support optimization and capacity planning.
Metric Categories
- Cache Performance: Hit rates, miss counts, load times
- Memory Usage: Cache sizes, memory consumption estimates
- Operation Counts: Load attempts, successful loads, failures
- Efficiency Metrics: Cache utilization, eviction rates
Example Usage
final stats = loader.getCacheStats();
// Performance monitoring
if (stats.hitRate < 0.8) {
print('Low cache hit rate: ${stats.hitRate}');
}
// Memory monitoring
if (stats.memoryUsage > maxMemoryThreshold) {
await loader.flush();
}
// Capacity planning
print('Classes loaded: ${stats.classCount}');
print('Average load time: ${stats.averageLoadTime}ms');
Constructors
- ClassLoaderStats({required int classCount, required int subclassCount, required int interfaceCount, required int declaredInterfaceCount, required int mixinCount, required int declaredMixinCount, required double hitRate, required int hitCount, required int missCount, required int memoryUsage, required double averageLoadTime, required int successfulLoads, required int failedLoads})
-
Statistics and metrics for ClassLoader cache performance monitoring.
const
- ClassLoaderStats.empty()
-
Creates empty statistics (all zeros).
const
Properties
- averageLoadTime → double
-
Average class loading time in milliseconds.
final
- classCount → int
-
Total number of classes currently cached.
final
- declaredInterfaceCount → int
-
Total number of declared interface relationships cached.
final
- declaredMixinCount → int
-
Total number of declared mixin relationships cached.
final
- failedLoads → int
-
Total number of failed class load attempts.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hitCount → int
-
Total number of cache hits since creation or last reset.
final
- hitRate → double
-
Cache hit rate as a percentage (0.0 to 1.0).
final
- interfaceCount → int
-
Total number of interface relationships cached.
final
- memoryUsage → int
-
Estimated memory usage in bytes.
final
- missCount → int
-
Total number of cache misses since creation or last reset.
final
- mixinCount → int
-
Total number of mixin relationships cached.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subclassCount → int
-
Total number of subclass relationships cached.
final
- successfulLoads → int
-
Total number of successful class loads.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited