| 693 | } |
| 694 | |
| 695 | Profiler Framework::get_profiler() const |
| 696 | { |
| 697 | Profiler profiler; |
| 698 | |
| 699 | const bool all_instruments = |
| 700 | std::any_of(_instruments.begin(), _instruments.end(), |
| 701 | [](InstrumentsDescription type) -> bool { return type.first == InstrumentType::ALL; }); |
| 702 | |
| 703 | auto is_selected = [&](InstrumentsDescription instrument) -> bool |
| 704 | { |
| 705 | return std::find_if(_instruments.begin(), _instruments.end(), |
| 706 | [&](InstrumentsDescription type) -> bool |
| 707 | { |
| 708 | const auto group = |
| 709 | static_cast<InstrumentType>(static_cast<uint64_t>(type.first) & 0xFF00); |
| 710 | return (group == instrument.first) && (instrument.second == type.second); |
| 711 | }) != _instruments.end(); |
| 712 | }; |
| 713 | |
| 714 | for (const auto &instrument : _available_instruments) |
| 715 | { |
| 716 | if (all_instruments || is_selected(instrument.first)) |
| 717 | { |
| 718 | profiler.add(instrument.second()); |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | return profiler; |
| 723 | } |
| 724 | |
| 725 | void Framework::add_printer(Printer *printer) |
| 726 | { |