ADD cpu logger

This commit is contained in:
2024-11-17 18:25:48 +01:00
parent 4c174ce444
commit c66c8a0963
4 changed files with 20 additions and 9 deletions

View File

@@ -54,13 +54,13 @@ static constexpr std::chrono::milliseconds kDisplayTask2Period = 1600ms;
static constexpr std::chrono::milliseconds kDisplayTask2Delay = 1200ms;
static constexpr std::chrono::milliseconds kDisplayTask2ComputationTime = 100ms;
// TODO: implement the constructor
BikeSystem::BikeSystem() :
_gearDevice(_timer),
_pedalDevice(_timer),
_resetDevice(_timer),
_speedometer(_timer)
_speedometer(_timer),
_cpuLogger(_timer)
{
}
@@ -70,14 +70,10 @@ void BikeSystem::start() {
init();
// TODO: implement the super-loop based for implementing the appropriate schedule
// Done
while (true) {
auto startTime = _timer.elapsed_time();
// TODO: implement calls to different tasks based on computed schedule
// Done
gearTask(); // 100ms : 0ms -> 100ms
gearTask(); // 100ms : 0ms -> 100ms
speedDistanceTask(); // 200ms : 100ms -> 300ms
displayTask1(); // 200ms : 300ms -> 500ms
speedDistanceTask(); // 200ms : 500ms -> 700ms
@@ -106,6 +102,10 @@ void BikeSystem::start() {
break;
}
#if !defined(MBED_TEST_MODE)
_cpuLogger.printStats();
#endif
}
}
@@ -144,7 +144,8 @@ void BikeSystem::gearTask() {
_currentGearSize = _gearDevice.getCurrentGearSize();
_taskLogger.logPeriodAndExecutionTime(
_timer, advembsof::TaskLogger::kGearTaskIndex, taskStartTime);
_timer, advembsof::TaskLogger::kGearTaskIndex, taskStartTime
);
}
void BikeSystem::speedDistanceTask() {
@@ -159,7 +160,8 @@ void BikeSystem::speedDistanceTask() {
_traveledDistance = _speedometer.getDistance();
_taskLogger.logPeriodAndExecutionTime(
_timer, advembsof::TaskLogger::kSpeedTaskIndex, taskStartTime);
_timer, advembsof::TaskLogger::kSpeedTaskIndex, taskStartTime
);
}
void BikeSystem::temperatureTask() {