LCOV - code coverage report

Current view
top level - src/worker - worker.stats.dart
Test
lcov.info
Date
2026-02-21
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines3535100.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 _totalWorkload++;
2820 if (_workload == 0) {
2920 _idle = microsecTimeStamp();
30 }
31 }
32
334 void failed() {
348 _totalErrors++;
35 }
36
37 /// Start timestamp
38 int? _started;
39
40 /// Stopped timestamp
41 int? _stopped;
42
43 /// Idle timestamp.
44 int _idle;
45
46 /// Current workload.
47 int _workload = 0;
48
49 /// Maximum acceptable workload.
50 int _maxWorkload = 0;
51
52 /// Total processed workload.
53 int _totalWorkload = 0;
54
55 /// Total errors.
56 int _totalErrors = 0;
57
5812 Duration _getUpTime(int microsec) => (_started == null)
59 ? Duration.zero
6018 : Duration(microseconds: microsec - _started!);
61
6218 Duration _getIdleTime(int microsec) => (_workload > 0)
63 ? Duration.zero
6418 : Duration(microseconds: microsec - _idle);
65
66 /// Indicates if the [Worker] has been stopped.
6722 bool get isStopped => _stopped != null;
68
696 WorkerStat get snapshot {
706 final ts = microsecTimeStamp();
716 return WorkerStatImpl.create(
7212 _worker.runtimeType,
7312 _worker.hashCode,
746 isStopped,
756 _workload,
766 _maxWorkload,
776 _totalWorkload,
786 _totalErrors,
7912 _getUpTime(_stopped ?? ts),
806 _getIdleTime(ts),
8118 _worker._channel?.getActiveConnections() ?? 0,
82 );
83 }
84}
Choose Features