LCOV - code coverage report

Current view
top level - src/worker - worker.stats.dart
Test
lcov.info
Date
2025-03-26
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(),
611 _workerType = w.runtimeType,
711 _workerHashCode = w.hashCode;
8
910 void start() {
1030 _idle = _started = microsecTimeStamp();
11 }
12
1311 void stop() {
1422 _stopped = microsecTimeStamp();
15 }
16
1710 void beginWork() {
1820 _workload++;
1930 if (_workload > _maxWorkload) {
2020 _maxWorkload = _workload;
21 }
22 }
23
2410 void endWork([dynamic _]) {
2520 _workload--;
2620 _idle = microsecTimeStamp();
2720 _totalWorkload++;
28 }
29
304 void failed() {
318 _totalErrors++;
32 }
33
34 /// Start timestamp
35 int? _started;
36
37 /// Stopped timestamp
38 int? _stopped;
39
40 /// Idle timestamp.
41 int _idle;
42
43 /// Current workload.
44 int _workload = 0;
45
46 /// Maximum acceptable workload.
47 int _maxWorkload = 0;
48
49 /// Total processed workload.
50 int _totalWorkload = 0;
51
52 /// Total errors.
53 int _totalErrors = 0;
54
5522 Duration _getUpTime(int microsec) => (_started == null)
56 ? Duration.zero
5718 : Duration(microseconds: microsec - _started!);
58
5933 Duration _getIdleTime(int microsec) => (_workload > 0)
60 ? Duration.zero
6133 : Duration(microseconds: microsec - _idle);
62
63 /// Indicates if the [Worker] has been stopped.
6422 bool get isStopped => _stopped != null;
65
66 final Type _workerType;
67 final int _workerHashCode;
68
6911 WorkerStat get snapshot {
7011 final ts = microsecTimeStamp();
7111 return WorkerStatImpl.create(
7211 _workerType,
7311 _workerHashCode,
7411 isStopped,
7511 _workload,
7611 _maxWorkload,
7711 _totalWorkload,
7811 _totalErrors,
7922 _getUpTime(_stopped ?? ts),
8011 _getIdleTime(ts),
81 );
82 }
83}
Choose Features