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

Function TEST_F

src/tests/resources_tests.cpp:4150–4205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4148
4149
4150TEST_F(Resources_Filter_BENCHMARK_Test, Filters)
4151{
4152 size_t totalOperations = 50000u;
4153
4154 Resources nonRevocable =
4155 Resources::parse("cpus:1;gpus:1;mem:128;disk:256").get();
4156
4157 Stopwatch watch;
4158
4159 watch.start();
4160 for (size_t i = 0; i < totalOperations; i++) {
4161 nonRevocable.nonRevocable();
4162 }
4163 watch.stop();
4164
4165 cout << "Took " << watch.elapsed()
4166 << " to perform " << totalOperations << " 'r.nonRevocable()' operations"
4167 << " on " << stringify(nonRevocable) << endl;
4168
4169 Resources revocable = createRevocableResource("cpus", "1", "*", true);
4170
4171 watch.start();
4172 for (size_t i = 0; i < totalOperations; i++) {
4173 revocable.revocable();
4174 }
4175 watch.stop();
4176
4177 cout << "Took " << watch.elapsed()
4178 << " to perform " << totalOperations << " 'r.revocable()' operations"
4179 << " on " << stringify(revocable) << endl;
4180
4181 Resources unReserved = nonRevocable;
4182
4183 watch.start();
4184 for (size_t i = 0; i < totalOperations; i++) {
4185 unReserved.unreserved();
4186 }
4187 watch.stop();
4188
4189 cout << "Took " << watch.elapsed()
4190 << " to perform " << totalOperations << " 'r.unreserved()' operations"
4191 << " on " << stringify(unReserved) << endl;
4192
4193 Resources reserved = Resources::parse(
4194 "cpus(role):1;gpus(role):1;mem(role):128;disk(role):256").get();
4195
4196 watch.start();
4197 for (size_t i = 0; i < totalOperations; i++) {
4198 reserved.reserved("role");
4199 }
4200 watch.stop();
4201
4202 cout << "Took " << watch.elapsed()
4203 << " to perform " << totalOperations << " 'r.reserved(role)' operations"
4204 << " on " << stringify(reserved) << endl;
4205}
4206
4207

Callers

nothing calls this directly

Calls 11

createRevocableResourceFunction · 0.85
elapsedMethod · 0.80
startMethod · 0.65
stopMethod · 0.65
parseFunction · 0.50
stringifyFunction · 0.50
getMethod · 0.45
nonRevocableMethod · 0.45
revocableMethod · 0.45
unreservedMethod · 0.45
reservedMethod · 0.45

Tested by

no test coverage detected