PerformanceMonitor class
Performance monitoring utilities for native_workmanager.
Provides tools to track and analyze:
- Task execution time
- Memory usage
- Event dispatch latency
- Task throughput
- Chain execution performance
Example usage:
final monitor = PerformanceMonitor.instance;
monitor.enable();
// Tasks are automatically tracked when they run
await NativeWorkManager.enqueue(...);
// Get performance statistics
final stats = monitor.getStatistics();
print('Average task duration: ${stats.averageTaskDuration}ms');
Properties
Methods
-
clear(
) → void - Clear all recorded data.
-
disable(
) → void - Disable performance monitoring.
-
enable(
) → void - Enable performance monitoring.
-
getAllTaskMetrics(
) → List< TaskMetrics> - Get all task metrics.
-
getStatistics(
) → PerformanceStatistics - Get performance statistics.
-
getTaskMetrics(
String taskId) → TaskMetrics? - Get metrics for a specific task.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recordChainComplete(
String chainId, bool success, Duration duration) → void - Record chain completion.
-
recordChainStart(
String chainId, int stepCount) → void - Record chain start.
-
recordEventDispatch(
String taskId, Duration latency) → void - Record event dispatch latency.
-
recordTaskComplete(
String taskId, bool success, {Map< String, dynamic> ? resultData}) → void - Record task completion.
-
recordTaskStart(
String taskId, String workerType) → void - Record task start.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → PerformanceMonitor
-
Singleton instance.
final