Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:42

0001 
0002 // Copyright 2022, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 
0006 #ifndef JANA2_SCALETESTS_H
0007 #define JANA2_SCALETESTS_H
0008 #include <JANA/Utils/JBenchUtils.h>
0009 #include <JANA/JEventProcessor.h>
0010 #include <JANA/JEventSource.h>
0011 
0012 namespace scaletest {
0013 struct DummySource : public JEventSource {
0014 
0015     DummySource() {
0016         SetCallbackStyle(CallbackStyle::ExpertMode);
0017     }
0018 
0019     Result Emit(JEvent& event) override {
0020         m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS);
0021         m_bench_utils.consume_cpu_ms(20);
0022         return Result::Success;
0023     }
0024 
0025     private:
0026         JBenchUtils m_bench_utils = JBenchUtils();
0027 };
0028 
0029 struct DummyData {int x;};
0030 struct DummyFactory : public JFactoryT<DummyData> {
0031     JBenchUtils m_bench_utils = JBenchUtils();
0032 
0033     void Process(const std::shared_ptr<const JEvent>& event) override {
0034         m_bench_utils.set_seed(event->GetEventNumber(), NAME_OF_THIS);
0035         m_bench_utils.consume_cpu_ms(70);
0036         Insert(new DummyData {22});
0037     }
0038 };
0039 
0040 struct DummyProcessor : public JEventProcessor {
0041 
0042     DummyProcessor() {
0043         SetCallbackStyle(CallbackStyle::ExpertMode);
0044     }
0045 
0046     void ProcessParallel(const JEvent& event) override {
0047         event.Get<DummyData>();
0048     }
0049 
0050     void Process(const JEvent& event) override {
0051         m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS);
0052         m_bench_utils.consume_cpu_ms(10);
0053     }
0054 
0055     private:
0056         JBenchUtils m_bench_utils = JBenchUtils();
0057 };
0058 } // namespace scaletest
0059 #endif //JANA2_SCALETESTS_H