GCC Code Coverage Report


Directory: ./
File: tasks/example_threads/seq/src/ops_seq.cpp
Date: 2025-10-01 01:19:45
Exec Total Coverage
Lines: 26 26 100.0%
Functions: 5 5 100.0%
Branches: 14 18 77.8%

Line Branch Exec Source
1 #include "example_threads/seq/include/ops_seq.hpp"
2
3 #include <numeric>
4 #include <vector>
5
6 #include "example_threads/common/include/common.hpp"
7 #include "util/include/util.hpp"
8
9 namespace nesterov_a_test_task_threads {
10
11 24 NesterovATestTaskSEQ::NesterovATestTaskSEQ(const InType& in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 24 GetInput() = in;
14 GetOutput() = 0;
15 24 }
16
17 24 bool NesterovATestTaskSEQ::ValidationImpl() {
18
2/4
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
24 return (GetInput() > 0) && (GetOutput() == 0);
19 }
20
21 24 bool NesterovATestTaskSEQ::PreProcessingImpl() {
22 24 GetOutput() = 2 * GetInput();
23 24 return GetOutput() > 0;
24 }
25
26 24 bool NesterovATestTaskSEQ::RunImpl() {
27
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
24 if (GetInput() == 0) {
28 return false;
29 }
30
31
2/2
✓ Branch 0 taken 72 times.
✓ Branch 1 taken 24 times.
96 for (InType i = 0; i < GetInput(); i++) {
32
2/2
✓ Branch 0 taken 216 times.
✓ Branch 1 taken 72 times.
288 for (InType j = 0; j < GetInput(); j++) {
33
2/2
✓ Branch 0 taken 648 times.
✓ Branch 1 taken 216 times.
864 for (InType k = 0; k < GetInput(); k++) {
34 648 std::vector<InType> tmp(i + j + k, 1);
35 648 GetOutput() += std::accumulate(tmp.begin(), tmp.end(), 0);
36
2/2
✓ Branch 0 taken 624 times.
✓ Branch 1 taken 24 times.
648 GetOutput() -= i + j + k;
37 }
38 }
39 }
40
41 24 const int num_threads = ppc::util::GetNumThreads();
42 24 GetOutput() *= num_threads;
43
44 int counter = 0;
45
2/2
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 24 times.
84 for (int i = 0; i < num_threads; i++) {
46 60 counter++;
47 }
48
49
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
24 if (counter != 0) {
50 24 GetOutput() /= counter;
51 }
52 24 return GetOutput() > 0;
53 }
54
55 24 bool NesterovATestTaskSEQ::PostProcessingImpl() {
56 24 GetOutput() -= GetInput();
57 24 return GetOutput() > 0;
58 }
59
60 } // namespace nesterov_a_test_task_threads
61