MCPcopy Create free account
hub / github.com/apache/mesos / foreach

Function foreach

src/tests/sorter_tests.cpp:1802–1929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1800 size_t clientCounts[] = {1U, 50U, 100U, 200U, 500U, 1000U};
1801
1802 foreach (size_t agentCount, agentCounts) {
1803 foreach (size_t clientCount, clientCounts) {
1804 cout << "Using " << agentCount << " agents and "
1805 << clientCount << " clients" << endl;
1806
1807 vector<SlaveID> agents;
1808 agents.reserve(agentCount);
1809
1810 vector<string> clients;
1811 clients.reserve(clientCount);
1812
1813 TypeParam sorter;
1814 Stopwatch watch;
1815
1816 watch.start();
1817 {
1818 for (size_t i = 0; i < clientCount; i++) {
1819 const string clientId = stringify(i);
1820
1821 clients.push_back(clientId);
1822
1823 sorter.add(clientId);
1824 }
1825 }
1826 watch.stop();
1827
1828 cout << "Added " << clientCount << " clients in "
1829 << watch.elapsed() << endl;
1830
1831 const ResourceQuantities agentScalarQuantities =
1832 *ResourceQuantities::fromString("cpus:24;mem:4096;disk:4096");
1833
1834 watch.start();
1835 {
1836 for (size_t i = 0; i < agentCount; i++) {
1837 SlaveID slaveId;
1838 slaveId.set_value("agent" + stringify(i));
1839
1840 agents.push_back(slaveId);
1841
1842 sorter.addSlave(slaveId, agentScalarQuantities);
1843 }
1844 }
1845 watch.stop();
1846
1847 cout << "Added " << agentCount << " agents in "
1848 << watch.elapsed() << endl;
1849
1850 Resources allocated = Resources::parse(
1851 "cpus:16;mem:2014;disk:1024").get();
1852
1853 // TODO(gyliu513): Parameterize the number of range for the fragment.
1854 Try<::mesos::Value::Ranges> ranges =
1855 fragment(createRange(31000, 32000), 100);
1856 ASSERT_SOME(ranges);
1857 ASSERT_EQ(100, ranges->range_size());
1858
1859 allocated += createPorts(ranges.get());

Callers

nothing calls this directly

Calls 15

fragmentFunction · 0.85
createRangeFunction · 0.85
createPortsFunction · 0.85
buildTreeFunction · 0.85
elapsedMethod · 0.80
startMethod · 0.65
stopMethod · 0.65
stringifyFunction · 0.50
parseFunction · 0.50
removeFunction · 0.50
reserveMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected