| 322 | |
| 323 | |
| 324 | bool valid(const set<string>& events) |
| 325 | { |
| 326 | vector<string> argv = {"stat"}; |
| 327 | |
| 328 | foreach (const string& event, events) { |
| 329 | argv.push_back("--event"); |
| 330 | argv.push_back(event); |
| 331 | } |
| 332 | |
| 333 | argv.push_back("true"); |
| 334 | |
| 335 | internal::Perf* perf = new internal::Perf(argv); |
| 336 | Future<string> output = perf->output(); |
| 337 | spawn(perf, true); |
| 338 | |
| 339 | output.await(); |
| 340 | |
| 341 | // We don't care about the output, just whether it exited non-zero. |
| 342 | return output.isReady(); |
| 343 | } |
| 344 | |
| 345 | |
| 346 | struct Sample |