Skip to content

Commit

Permalink
+ set activation time always to 0
Browse files Browse the repository at this point in the history
+ evaluate session id for resetting autosave count down
  • Loading branch information
chrxh committed Nov 10, 2024
1 parent 3651f8b commit c453fc7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/EngineGpuKernels/ConstructorProcessor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ ConstructorProcessor::constructCellIntern(
result->inputExecutionOrderNumber = constructionData.inputExecutionOrderNumber;
result->outputBlocked = constructionData.outputBlocked;

result->activationTime = OffspringActivationTime;
result->activationTime = 0;
result->genomeComplexity = hostCell->genomeComplexity;

auto genomeCurrentBytePosition = constructionData.genomeCurrentBytePosition;
Expand Down
2 changes: 0 additions & 2 deletions source/EngineInterface/CellFunctionConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,3 @@ enum ActivityOrigin_
ActivityOrigin_Unknown,
ActivityOrigin_Sensor
};

auto constexpr OffspringActivationTime = 5;
8 changes: 5 additions & 3 deletions source/Gui/AutosaveWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ void AutosaveWindow::onDeleteSavepoint(SavepointEntry const& entry)
void AutosaveWindow::onLoadSavepoint(SavepointEntry const& entry)
{
FileTransferController::get().onOpenSimulation(entry->filename);
if (_autosaveEnabled) {
_lastAutosaveTimepoint = std::chrono::steady_clock::now();
}
}

void AutosaveWindow::processCleanup()
Expand All @@ -367,6 +364,11 @@ void AutosaveWindow::processAutomaticSavepoints()
return;
}

if (!_lastSessionId.has_value() || _lastSessionId.value() != _simulationFacade->getSessionId()) {
_lastAutosaveTimepoint = std::chrono::steady_clock::now();
_lastSessionId = _simulationFacade->getSessionId();
}

auto minSinceLastAutosave = std::chrono::duration_cast<std::chrono::minutes>(std::chrono::steady_clock::now() - _lastAutosaveTimepoint).count();
if (minSinceLastAutosave >= _autosaveInterval && _savepointTable.has_value()) {
onCreateSavepoint(_catchPeaks != CatchPeaks_None);
Expand Down
1 change: 1 addition & 0 deletions source/Gui/AutosaveWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ class AutosaveWindow : public AlienWindow<SimulationFacade, PersisterFacade>
std::chrono::steady_clock::time_point _lastPeakTimepoint;
TaskProcessor _peakProcessor;
SharedDeserializedSimulation _peakDeserializedSimulation;
std::optional<int> _lastSessionId;
};

0 comments on commit c453fc7

Please sign in to comment.