| 556 | |
| 557 | template <typename T> |
| 558 | static void run(const string& name, long repeats) |
| 559 | { |
| 560 | Promise<Nothing> promise; |
| 561 | |
| 562 | Owned<DispatchProcess> process(new DispatchProcess(&promise, repeats)); |
| 563 | spawn(*process); |
| 564 | |
| 565 | T data{std::vector<int>(10240, 42)}; |
| 566 | |
| 567 | Stopwatch watch; |
| 568 | watch.start(); |
| 569 | |
| 570 | dispatch(process.get(), &DispatchProcess::handler<T>, data); |
| 571 | |
| 572 | AWAIT_READY(promise.future()); |
| 573 | |
| 574 | cout << name << " elapsed: " << watch.elapsed() << endl; |
| 575 | |
| 576 | terminate(process.get()); |
| 577 | wait(process.get()); |
| 578 | } |
| 579 | |
| 580 | private: |
| 581 | Future<Nothing> _handler() |