49 std::set<std::string>
const& processesToKeep,
50 std::vector<unsigned int>
const& nEntries,
51 std::vector<unsigned int>& finalIndexToStoredIndex)
const {
54 bool isModified =
false;
55 unsigned int finalSize = 0;
56 for (
auto const&
process : storedProcesses) {
57 if (processesToKeep.find(
process) == processesToKeep.end()) {
67 std::vector<std::string> finalProcesses;
68 finalProcesses.reserve(finalSize);
69 finalIndexToStoredIndex.reserve(finalSize);
70 for (
unsigned int iStored = 0; iStored < storedProcesses.size(); ++iStored) {
71 if (processesToKeep.find(storedProcesses[iStored]) != processesToKeep.end()) {
72 finalProcesses.emplace_back(storedProcesses[iStored]);
73 finalIndexToStoredIndex.emplace_back(iStored);
84 std::set<std::string>
const& processesToKeep,
85 std::vector<unsigned int>
const& nEntries,
86 std::vector<unsigned int>& finalIndexToStoredIndex,
87 std::vector<std::string>
const& firstFileFinalProcesses)
const {
90 std::vector<std::string> finalProcesses;
92 finalProcesses.reserve(storedProcesses.size());
93 finalIndexToStoredIndex.reserve(storedProcesses.size());
97 for (
unsigned int iFirst = 0; iFirst < firstFileFinalProcesses.size(); ++iFirst) {
99 for (
unsigned int iStored = 0; iStored < storedProcesses.size(); ++iStored) {
100 std::string const& storedProcess = storedProcesses[iStored];
101 if (firstFileFinalProcesses[iFirst] == storedProcess) {
103 if (processesToKeep.find(storedProcess) != processesToKeep.end()) {
104 finalProcesses.emplace_back(storedProcess);
105 finalIndexToStoredIndex.emplace_back(iStored);
112 bool isModified =
true;
113 if (storedProcesses == finalProcesses) {
133 std::vector<unsigned int>
const& nEntries) {
146 }
else if (!storedProcesses.empty()) {
149 }
else if (storedProcesses.empty()) {
172 std::vector<std::string>& finalProcesses,
173 std::vector<unsigned int>
const& nEntries,
174 std::vector<unsigned int>
const& finalIndexToStoredIndex)
const {
178 assert(!storedProcesses.empty());
179 std::vector<unsigned int> newCacheIndices;
180 if (!finalProcesses.empty()) {
185 std::vector<unsigned int> oldOffsets;
186 oldOffsets.reserve(storedProcesses.size());
188 for (
auto const& entries :
nEntries) {
189 oldOffsets.emplace_back(
offset);
193 unsigned int nFinalProcesses = finalProcesses.size();
194 std::vector<unsigned int> newOffsets;
195 newOffsets.reserve(nFinalProcesses);
197 for (
unsigned int iNew = 0; iNew < nFinalProcesses; ++iNew) {
198 newOffsets.emplace_back(
offset);
202 unsigned int nOuterLoop = storedCacheIndices.size() / storedProcesses.size();
203 assert(nOuterLoop * storedProcesses.size() == storedCacheIndices.size());
204 newCacheIndices.reserve(nOuterLoop * nFinalProcesses);
205 unsigned int storedOuterOffset = 0;
207 for (
unsigned int k = 0;
k < nOuterLoop; ++
k) {
208 for (
unsigned int j = 0;
j < nFinalProcesses; ++
j) {
209 unsigned int storedIndex = finalIndexToStoredIndex[
j];
210 unsigned int oldCacheIndex = storedCacheIndices[storedOuterOffset + storedIndex];
213 newCacheIndex = oldCacheIndex - oldOffsets[storedIndex] + newOffsets[
j];
215 newCacheIndices.emplace_back(newCacheIndex);
217 storedOuterOffset += storedProcesses.size();
225 std::vector<unsigned int>
const& storedCacheIndices,
226 std::vector<unsigned int>
const& nEntries) {
235 for (
unsigned int k = 0;
k < storedProcesses.size(); ++
k) {
237 firstFileToStored[
j] =
k;
246 unsigned int nCacheIndexVectors = storedCacheIndices.size() / storedProcesses.size();
247 assert(storedProcesses.size() * nCacheIndexVectors == storedCacheIndices.size());
249 unsigned int storedIndex = 0;
250 for (
unsigned int k = 0;
k < nCacheIndexVectors; ++
k) {
253 unsigned int iStored = firstFileToStored[
j];
257 unsigned int oldCacheIndex = storedCacheIndices[storedIndex];
272 unsigned int entriesThisFile = 0;
273 for (
auto const& entries :
nEntries) {
274 entriesThisFile += entries;