24 #include "cheetah/emulator/EmulatorAppConfig.h" 25 #include "cheetah/rcpt/PacketGenerator.h" 26 #include "cheetah/emulator/Factory.h" 27 #include "cheetah/emulator/Config.h" 28 #include "cheetah/rcpt/RcptTimerStats.h" 29 #include "cheetah/rcpt/UdpStream.h" 30 #include "panda/BasicAppConfig.h" 31 #include "panda/IpAddress.h" 32 #include "panda/TupleUtilities.h" 33 #include "panda/Log.h" 37 #include <type_traits> 60 unsigned iterations()
const {
65 void add_options(OptionsDescriptionEasyInit& add_options)
override 68 (
"iter", boost::program_options::value<unsigned>(&_iterations)->default_value(_iterations),
"number of chunks to process for each test");
69 EmulatorAppConfig::add_options(add_options);
78 typedef std::chrono::high_resolution_clock ClockType;
80 int main(
int argc,
char** argv) {
83 typedef uint8_t DataType;
92 if( (rv=app_config.parse(argc, argv)) )
return rv;
95 auto& rcpt_config = app_config.rcpt_config();
96 ska::panda::IpAddress address(0,
"127.0.0.1");
97 boost::asio::ip::udp::endpoint local_endpoint = address.end_point<boost::asio::ip::udp::endpoint>();
100 ska::panda::DataManager<ska::cheetah::rcpt::UdpStream> dm(stream);
102 auto endpoint = stream.local_end_point();
103 emulator_config.
fixed_address(ska::panda::IpAddress(endpoint));
108 typedef typename FactoryType::EmulatorType EmulatorType;
109 FactoryType factory(emulator_config, generator_factory);
110 std::unique_ptr<EmulatorType> emulator(factory.create(emulator_config.
generator()
111 , ska::cheetah::data::DimensionSize<ska::cheetah::data::Frequency>(rcpt_config.
number_of_channels())
112 , ska::cheetah::data::DimensionSize<ska::cheetah::data::Time>(rcpt_config.
samples_per_chunk())));
113 PANDA_LOG <<
"emulator using generator: '" << emulator_config.
generator() <<
"'";
115 std::thread th([&]() { emulator->run(); });
119 unsigned iter_max = app_config.iterations();
120 for(
unsigned iter=0; iter < iter_max; ++iter)
123 stats(*std::get<ska::panda::Index<std::shared_ptr<typename ska::cheetah::rcpt::BeamFormerDataTraits::DataType>,
typename decltype(dm)::DataSetType>::value>(data), ClockType::now());
125 PANDA_LOG <<
"\n----\n\t" << stats <<
"\n----";
129 catch(std::exception
const& e) {
130 std::cerr <<
"Emulator: " << e.what() << std::endl;
133 std::cerr <<
"Emulator: unknown exception caught" << std::endl;
construct a suitable generatro object
Packs data into a UDP stream Packet Header format of the BeamFormer.
unsigned number_of_channels() const
return the number of channels in a chunk
factory to construct emulators
unsigned samples_per_chunk() const
return the number of time samples in a chunk
cheetah::generators::Config const & generators_config() const
the configuration block for generators
Configuration options for the Emulator.
boost::asio::ip::udp::endpoint remote_end_point() const
geters and setters for the UDP connection (IP address and port or remote peer)
void fixed_address(panda::IpAddress const &)
set the address to stream UDP packets to
Top level configuration for the emulator app.
std::string const & generator() const
the name of the data generator to use
configurable parameters for the rcpt
Calculate rcpt specific performance information.
void set_generator_list(std::vector< std::string > const &generator_names)
set the known generators