File indexing completed on 2025-01-18 10:01:40
0001
0002
0003
0004
0005 #pragma once
0006
0007 #include <memory>
0008 #include <JANA/JService.h>
0009 #include <JANA/Utils/JProcessorMapping.h>
0010 #include <JANA/Engine/JPerfMetrics.h> // TODO: Should't be here
0011
0012 #include <JANA/Services/JParameterManager.h>
0013 #include <JANA/Services/JComponentManager.h>
0014
0015
0016 class JParameterManager;
0017 class JComponentManager;
0018 class JArrow;
0019 class JQueue;
0020 class JPoolBase;
0021 class JQueue;
0022 class JFoldArrow;
0023 class JUnfoldArrow;
0024 class JEventPool;
0025
0026 class JTopologyBuilder : public JService {
0027 public:
0028
0029 Service<JParameterManager> m_params {this};
0030 std::shared_ptr<JComponentManager> m_components;
0031
0032
0033 std::vector<JArrow*> arrows;
0034 std::vector<JQueue*> queues;
0035 std::vector<JPoolBase*> pools;
0036
0037
0038 size_t m_event_pool_size = 4;
0039 size_t m_event_queue_threshold = 80;
0040 size_t m_event_source_chunksize = 40;
0041 size_t m_event_processor_chunksize = 1;
0042 size_t m_location_count = 1;
0043 bool m_enable_stealing = false;
0044 bool m_limit_total_events_in_flight = true;
0045 int m_affinity = 0;
0046 int m_locality = 0;
0047
0048
0049 std::function<void(JTopologyBuilder&)> m_configure_topology;
0050 JEventPool* event_pool = nullptr;
0051 JPerfMetrics metrics;
0052 JProcessorMapping mapping;
0053
0054 public:
0055
0056 JTopologyBuilder();
0057 ~JTopologyBuilder() override;
0058
0059 void acquire_services(JServiceLocator *sl) override;
0060
0061
0062
0063
0064
0065 void set_configure_fn(std::function<void(JTopologyBuilder&)> configure_fn);
0066
0067 void create_topology();
0068
0069 void attach_lower_level(JEventLevel current_level, JUnfoldArrow* parent_unfolder, JFoldArrow* parent_folder, bool found_sink);
0070
0071 void attach_top_level(JEventLevel current_level);
0072
0073 std::string print_topology();
0074
0075
0076 };
0077
0078