Files
CMake/Source/CTest/cmCTestBinPacker.h
Kyle Edwards aee0964851 CTest: Add bin-packing algorithm
This algorithm is used to determine whether or not a test can
execute with the available resources. It uses a recursive largest-
first algorithm to try to place the tests into their respective
slots.
2019-10-02 09:33:54 -04:00

32 lines
903 B
C++

/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmCTestBinPacker_h
#define cmCTestBinPacker_h
#include <cstddef>
#include <map>
#include <string>
#include <vector>
#include "cmCTestHardwareAllocator.h"
struct cmCTestBinPackerAllocation
{
std::size_t ProcessIndex;
int SlotsNeeded;
std::string Id;
bool operator==(const cmCTestBinPackerAllocation& other) const;
bool operator!=(const cmCTestBinPackerAllocation& other) const;
};
bool cmAllocateCTestHardwareRoundRobin(
const std::map<std::string, cmCTestHardwareAllocator::Resource>& hardware,
std::vector<cmCTestBinPackerAllocation>& allocations);
bool cmAllocateCTestHardwareBlock(
const std::map<std::string, cmCTestHardwareAllocator::Resource>& hardware,
std::vector<cmCTestBinPackerAllocation>& allocations);
#endif