...
This shows that the algorithm is essentially linearly dependent on the number of events (apart from a short initialization time):
Profiling
I used this command to profile the execution:
...
and then the tool kcachegrind to produce this plot:
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:
Boost | Execution time (s) | Old execution time (s) |
---|---|---|
10 | 7.636 | 20.802 |
50 | 28.375 | 92.315 |
100 | 197.873 | 53.868 |