MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / wait_for_full_scenario

Function wait_for_full_scenario

performance-tests/bench/node_controller/main.cpp:838–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836}
837
838void wait_for_full_scenario(
839 const std::string& name,
840 NodeId this_node_id,
841 StatusDataWriter_var status_writer_impl,
842 AllocatedScenarioDataReader_var allocated_scenario_reader_impl,
843 Bench::TestController::AllocatedScenario& result)
844{
845 using Builder::ZERO;
846
847 Bench::TestController::AllocatedScenario allocated_scenario;
848 allocated_scenario.scenario_id = TAO::String_Manager();
849 allocated_scenario.launch_time = ZERO;
850 std::chrono::system_clock::time_point initial_attempt;
851
852 bool complete = false;
853 while (!complete) {
854 while (!wait_for_scenario_data(*allocated_scenario_reader_impl)) {
855 // There was an actual DDS failure of some kind (not just a timeout), give it a few seconds and retry
856 std::this_thread::sleep_for(std::chrono::seconds(3));
857 }
858
859 DDS::ReturnCode_t rc = DDS::RETCODE_ERROR;
860 Bench::TestController::AllocatedScenarioSeq scenarios;
861 DDS::SampleInfoSeq info;
862 rc = allocated_scenario_reader_impl->take(
863 scenarios, info,
864 DDS::LENGTH_UNLIMITED,
865 DDS::ANY_SAMPLE_STATE,
866 DDS::ANY_VIEW_STATE,
867 DDS::ANY_INSTANCE_STATE);
868 if (rc != DDS::RETCODE_OK) {
869 std::cerr << "Take node config failed\n" << std::flush;
870 continue;
871 }
872
873 if (allocated_scenario.scenario_id != TAO::String_Manager() &&
874 initial_attempt + std::chrono::seconds(30) < std::chrono::system_clock::now()) {
875 if (write_status(name, this_node_id, AVAILABLE, *status_writer_impl)) {
876 allocated_scenario.scenario_id = TAO::String_Manager();
877 allocated_scenario.launch_time = ZERO;
878 }
879 }
880
881 for (CORBA::ULong scenario = 0; scenario < scenarios.length(); ++scenario) {
882 Bench::NodeController::Configs& configs = scenarios[scenario].configs;
883 for (CORBA::ULong node = 0; node < configs.length(); ++node) {
884 if (configs[node].node_id == this_node_id) {
885 if (allocated_scenario.scenario_id == TAO::String_Manager()) {
886 if (write_status(name, this_node_id, BUSY, *status_writer_impl)) {
887 allocated_scenario = scenarios[scenario];
888 initial_attempt = std::chrono::system_clock::now();
889 }
890 }
891 }
892 }
893 if (std::string(scenarios[scenario].scenario_id.in()) == std::string(allocated_scenario.scenario_id.in()) &&
894 !(scenarios[scenario].launch_time == ZERO))
895 {

Callers 1

run_cycleFunction · 0.85

Calls 5

wait_for_scenario_dataFunction · 0.85
write_statusFunction · 0.85
takeMethod · 0.45
lengthMethod · 0.45
inMethod · 0.45

Tested by

no test coverage detected