| 4148 | |
| 4149 | |
| 4150 | TEST_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 |
nothing calls this directly
no test coverage detected