| 48 | } |
| 49 | }; |
| 50 | void TContextDistributor::DoSend() { |
| 51 | CHROMIUM_TRACE_FUNCTION(); |
| 52 | |
| 53 | if (QueryProc.Get() == nullptr) |
| 54 | return; |
| 55 | |
| 56 | TVector<TCtxTransferSrc> srcHolder; |
| 57 | TVector<TRequiredTransfer> xferList; |
| 58 | srcHolder.reserve(100); |
| 59 | |
| 60 | bool allComplete = true; |
| 61 | for (THashMap<int, TFullCtxInfo>::iterator i = EnvId2Info.begin(); i != EnvId2Info.end(); ++i) { |
| 62 | TFullCtxInfo& info = i->second; |
| 63 | for (int hostId = 0; hostId < info.HostId2Computer.ysize(); ++hostId) { |
| 64 | bool& isFullyDistributed = info.IsFullyDistributed[hostId]; |
| 65 | if (isFullyDistributed) |
| 66 | continue; |
| 67 | |
| 68 | isFullyDistributed = true; |
| 69 | const TVector<int>& compList = info.HostId2Computer[hostId]; |
| 70 | int partCount = info.Data[hostId].GetPartCount(); |
| 71 | for (int part = 0; part < partCount; ++part) { |
| 72 | int srcCount = 0; |
| 73 | int srcGroupId = srcHolder.ysize(); |
| 74 | TCtxTransferSrc& src = srcHolder.emplace_back(); |
| 75 | TVector<int> target; |
| 76 | if (info.Data[hostId].Info.Get()) |
| 77 | src.SrcComps.push_back(-1); |
| 78 | for (int z = 0; z < compList.ysize(); ++z) { |
| 79 | int compId = compList[z]; |
| 80 | if (info.ReadyMask[compId][part]) { |
| 81 | ++srcCount; |
| 82 | if (ComputerSendCount[compId] < MAX_SIMULTANEOUS_SENDS) { |
| 83 | src.SrcComps.push_back(compId); |
| 84 | } |
| 85 | } else { |
| 86 | isFullyDistributed = false; |
| 87 | allComplete = false; |
| 88 | if (!info.CopyInitiated[compId][part]) { |
| 89 | target.push_back(compId); |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | if (!target.empty() && !src.SrcComps.empty()) { |
| 94 | Shuffle(src.SrcComps.begin(), src.SrcComps.end()); |
| 95 | for (int z = 0; z < target.ysize(); ++z) { |
| 96 | TRequiredTransfer xfer; |
| 97 | xfer.EnvId = i->first; |
| 98 | xfer.HostId = hostId; |
| 99 | xfer.Part = part; |
| 100 | xfer.SrcGroupId = srcGroupId; |
| 101 | xfer.DstComp = target[z]; |
| 102 | xfer.SrcCount = srcCount; |
| 103 | xferList.push_back(xfer); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | } |
nothing calls this directly
no test coverage detected