MCPcopy Create free account
hub / github.com/SoarGroup/Soar / DirectRun

Method DirectRun

Core/KernelSML/src/sml_KernelSML.cpp:761–802  ·  view source on GitHub ↗

A fully direct run would be a call straight to gSKI but supporting that is too dangerous due to the extra events and control logic surrounding the SML RunScheduler. So we compromise with a call directly to that scheduler, boosting performance over the standard "run" path which goes through the command line processor.

Source from the content-addressed store, hash-verified

759// So we compromise with a call directly to that scheduler, boosting performance over the standard "run" path
760// which goes through the command line processor.
761void KernelSML::DirectRun(char const* pAgentName, bool forever, int stepSize, int interleaveSizeIn, uint64_t count)
762{
763 smlRunStepSize interleaveSize = static_cast<smlRunStepSize>(interleaveSizeIn);
764
765 RunScheduler* pScheduler = GetRunScheduler() ;
766 smlRunFlags runFlags = sml_NONE ;
767
768 // Decide on the type of run.
769 smlRunStepSize runType = (forever) ? sml_DECISION : static_cast<smlRunStepSize>(stepSize) ;
770
771 // Decide how large of a step to run each agent before switching to the next agent
772 pScheduler->VerifyStepSizeForRunType(forever, runType, interleaveSize) ;
773
774 if (pAgentName)
775 {
776 AgentSML* pAgentSML = GetAgentSML(pAgentName);
777 if (!pAgentSML)
778 {
779 return ;
780 }
781
782 runFlags = smlRunFlags(runFlags | sml_RUN_SELF) ;
783
784 // Schedule just this one agent to run
785 pScheduler->ScheduleAllAgentsToRun(false) ;
786 pScheduler->ScheduleAgentToRun(pAgentSML, true) ;
787 }
788 else
789 {
790 runFlags = smlRunFlags(runFlags | sml_RUN_ALL) ;
791
792 // Ask all agents to run
793 pScheduler->ScheduleAllAgentsToRun(true) ;
794 }
795
796 // If we're running by decision cycle synchronize up the agents to the same phase before we start
797 bool synchronizeAtStart = (runType == sml_DECISION) ;
798
799 // Do the run
800 pScheduler->RunScheduledAgents(forever, runType, count, runFlags, smlRunStepSize(interleaveSize), synchronizeAtStart) ;
801 return ;
802}

Callers

nothing calls this directly

Calls 7

GetRunSchedulerFunction · 0.85
smlRunFlagsEnum · 0.50
smlRunStepSizeEnum · 0.50
ScheduleAgentToRunMethod · 0.45
RunScheduledAgentsMethod · 0.45

Tested by

no test coverage detected