GCC Code Coverage Report


Directory: ./
File: tasks/shkrebko_m_shell_sort_batcher_merge/common/include/mpi_utils.hpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 14 14 100.0%
Functions: 2 2 100.0%
Branches: 3 6 50.0%

Line Branch Exec Source
1 #pragma once
2
3 #include <mpi.h>
4
5 #include <cstddef>
6 #include <vector>
7
8 namespace shkrebko_m_shell_sort_batcher_merge {
9
10 3 inline std::vector<int> RecvVector(int src, int tag_base, MPI_Comm comm) {
11 3 int sz = 0;
12 3 MPI_Status status{};
13 3 MPI_Recv(&sz, 1, MPI_INT, src, tag_base, comm, &status);
14
15 3 std::vector<int> v(static_cast<std::size_t>(sz));
16
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (sz > 0) {
17
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 MPI_Recv(v.data(), sz, MPI_INT, src, tag_base + 1, comm, &status);
18 }
19 3 return v;
20 }
21
22 3 inline void SendVector(int dst, int tag_base, const std::vector<int> &v, MPI_Comm comm) {
23 3 const int sz = static_cast<int>(v.size());
24 3 MPI_Send(&sz, 1, MPI_INT, dst, tag_base, comm);
25
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (sz > 0) {
26 3 MPI_Send(v.data(), sz, MPI_INT, dst, tag_base + 1, comm);
27 }
28 3 }
29
30 } // namespace shkrebko_m_shell_sort_batcher_merge
31