LCOV - code coverage report

Current view
top level - src/worker - worker.stats.dart
Test
lcov.info
Date
2025-07-05
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines3434100.0%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1part of 'worker.dart';
2
3class _Stats {
411 _Stats(Worker w)
511 : _idle = microsecTimeStamp(),
6 _worker = w;
7
8 final Worker _worker;
9
1010 void start() {
1130 _idle = _started = microsecTimeStamp();
12 }
13
1411 void stop() {
1522 _stopped = microsecTimeStamp();
16 }
17
1810 void beginWork() {
1920 _workload++;
2030 if (_workload > _maxWorkload) {
2120 _maxWorkload = _workload;
22 }
23 }
24
2510 void endWork([dynamic _]) {
2620 _workload--;
2720 _idle = microsecTimeStamp();
2820 _totalWorkload++;
29 }
30
314 void failed() {
328 _totalErrors++;
33 }
34
35 /// Start timestamp
36 int? _started;
37
38 /// Stopped timestamp
39 int? _stopped;
40
41 /// Idle timestamp.
42 int _idle;
43
44 /// Current workload.
45 int _workload = 0;
46
47 /// Maximum acceptable workload.
48 int _maxWorkload = 0;
49
50 /// Total processed workload.
51 int _totalWorkload = 0;
52
53 /// Total errors.
54 int _totalErrors = 0;
55
5612 Duration _getUpTime(int microsec) => (_started == null)
57 ? Duration.zero
5818 : Duration(microseconds: microsec - _started!);
59
6018 Duration _getIdleTime(int microsec) => (_workload > 0)
61 ? Duration.zero
6218 : Duration(microseconds: microsec - _idle);
63
64 /// Indicates if the [Worker] has been stopped.
6522 bool get isStopped => _stopped != null;
66
676 WorkerStat get snapshot {
686 final ts = microsecTimeStamp();
696 return WorkerStatImpl.create(
7012 _worker.runtimeType,
7112 _worker.hashCode,
726 isStopped,
736 _workload,
746 _maxWorkload,
756 _totalWorkload,
766 _totalErrors,
7712 _getUpTime(_stopped ?? ts),
786 _getIdleTime(ts),
7918 _worker._channel?.activeConnections ?? 0,
80 );
81 }
82}
Choose Features