Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This shows that the algorithm is essentially linearly dependent on the number of events (apart from a short initialization time):

Image Removed

Profiling

I used this command to profile the execution:

...

and then the tool kcachegrind to produce this plot:

Image Added

 

I am puzzled by the fact that 50 % of the time is spent in the FluxSource::fullTitle() function, which afaik should only return the full name of the source. The relevant piece of code which calls fullTitle is in observationSim/src/Simulator.cxx:

Code Block
void Simulator::makeEvents(EventContainer &events, 
                           ScDataContainer &scData, 
                           std::vector<irfInterface::Irfs *> &respPtrs, 
                           Spacecraft *spacecraft,
                           bool useSimTime) {
   m_useSimTime = useSimTime;
   m_elapsedTime = 0.;
// Loop over event generation steps until done.
   while (!done()) {

         ...
         
         std::string name = m_newEvent->fullTitle();
         if (name.find("TimeTick") != std::string::npos) {
            if (!m_usePointingHistory) {
               scData.addScData(m_newEvent, spacecraft);
            }
         } else {
            if (events.addEvent(m_newEvent, respPtrs, spacecraft)) {
               m_numEvents++;
            }
         }

    ...

   } // while (!done())
}

This is essentially only checking if the name contains "TimeTick", because in that case it has to generate a new piece of simulated FT2 file. In my case I am using a real FT2 file, so the check is false. Now, just by substituting that line with:

Code Block
  while (!done()) {

         ...
         
         //std::string name = m_newEvent->fullTitle();
         
         std::string name = "just a source";
         
         if (name.find("TimeTick") != std::string::npos) {
            if (!m_usePointingHistory) {
               scData.addScData(m_newEvent, spacecraft);
            }
         } else {
            if (events.addEvent(m_newEvent, respPtrs, spacecraft)) {
               m_numEvents++;
            }
         }

    ...

   } // while (!done())

I reduce the execution time to ~1/3 of what they used to be:

BoostExecution time (s)Old execution time (s)
107.63620.802
5028.37592.315
100197.87353.868