From 2aac3c67ee7402a8a004f5231df830ccd52b3404 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 14 Feb 2023 11:10:18 +0100 Subject: [PATCH] instrumented some more tasks --- bsp_q7s/OBSWConfig.h.in | 1 - bsp_q7s/core/CoreController.cpp | 1 - bsp_q7s/core/CoreController.h | 1 + linux/devices/ploc/PlocMPSoCHelper.cpp | 4 +++- linux/devices/ploc/PlocMPSoCHelper.h | 5 +++++ linux/devices/ploc/PlocSupvUartMan.cpp | 3 +++ linux/devices/ploc/PlocSupvUartMan.h | 5 +++++ mission/controller/AcsController.cpp | 1 - mission/controller/AcsController.h | 2 +- mission/devices/BpxBatteryHandler.cpp | 2 -- mission/devices/BpxBatteryHandler.h | 2 +- mission/devices/SolarArrayDeploymentHandler.cpp | 1 + mission/devices/SolarArrayDeploymentHandler.h | 3 ++- mission/trace.h | 2 ++ 14 files changed, 24 insertions(+), 9 deletions(-) diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index a86dd8c7..687d9363 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -77,7 +77,6 @@ // If this is enabled, all other I2C code should be disabled #define OBSW_ADD_I2C_TEST_CODE 0 #define OBSW_ADD_UART_TEST_CODE 0 -#define OBSW_THREAD_TRACING 1 #define OBSW_TEST_ACS 0 #define OBSW_DEBUG_ACS 0 diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 79dc68f5..4ff4965f 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -9,7 +9,6 @@ #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/timemanager/Stopwatch.h" #include "fsfw/version.h" -#include "mission/trace.h" #include "watchdog/definitions.h" #if OBSW_ADD_TMTC_UDP_SERVER == 1 #include "fsfw/osal/common/UdpTmTcBridge.h" diff --git a/bsp_q7s/core/CoreController.h b/bsp_q7s/core/CoreController.h index 36cf5d27..65ee20ef 100644 --- a/bsp_q7s/core/CoreController.h +++ b/bsp_q7s/core/CoreController.h @@ -12,6 +12,7 @@ #include "events/subsystemIdRanges.h" #include "fsfw/controller/ExtendedControllerBase.h" #include "mission/devices/devicedefinitions/GPSDefinitions.h" +#include "mission/trace.h" class Timer; class SdCardManager; diff --git a/linux/devices/ploc/PlocMPSoCHelper.cpp b/linux/devices/ploc/PlocMPSoCHelper.cpp index fcd5178b..fca2e51c 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.cpp +++ b/linux/devices/ploc/PlocMPSoCHelper.cpp @@ -3,7 +3,6 @@ #include #include -#include "OBSWConfig.h" #ifdef XIPHOS_Q7S #include "bsp_q7s/fs/FilesystemHelper.h" #endif @@ -34,6 +33,9 @@ ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) { ReturnValue_t result = returnvalue::OK; semaphore.acquire(); while (true) { +#if OBSW_THREAD_TRACING == 1 + trace::threadTrace(opCounter, "PLOC MPSOC Helper"); +#endif switch (internalState) { case InternalState::IDLE: { semaphore.acquire(); diff --git a/linux/devices/ploc/PlocMPSoCHelper.h b/linux/devices/ploc/PlocMPSoCHelper.h index c39cc758..dea35a82 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.h +++ b/linux/devices/ploc/PlocMPSoCHelper.h @@ -11,6 +11,7 @@ #include "fsfw/tmtcservices/SourceSequenceCounter.h" #include "fsfw_hal/linux/serial/SerialComIF.h" #include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" +#include "mission/trace.h" #ifdef XIPHOS_Q7S #include "bsp_q7s/fs/SdCardManager.h" #endif @@ -116,6 +117,10 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF { struct FlashWrite flashWrite; +#if OBSW_THREAD_TRACING == 1 + uint32_t opCounter = 0; +#endif + enum class InternalState { IDLE, FLASH_WRITE, FLASH_READ }; InternalState internalState = InternalState::IDLE; diff --git a/linux/devices/ploc/PlocSupvUartMan.cpp b/linux/devices/ploc/PlocSupvUartMan.cpp index 1fd2b841..5113de40 100644 --- a/linux/devices/ploc/PlocSupvUartMan.cpp +++ b/linux/devices/ploc/PlocSupvUartMan.cpp @@ -101,6 +101,9 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) { lock->unlockMutex(); semaphore->acquire(); putTaskToSleep = false; +#if OBSW_THREAD_TRACING == 1 + trace::threadTrace(opCounter, "PLOC SUPV Helper PST"); +#endif while (true) { if (putTaskToSleep) { performUartShutdown(); diff --git a/linux/devices/ploc/PlocSupvUartMan.h b/linux/devices/ploc/PlocSupvUartMan.h index e1539c97..b787815f 100644 --- a/linux/devices/ploc/PlocSupvUartMan.h +++ b/linux/devices/ploc/PlocSupvUartMan.h @@ -7,6 +7,7 @@ #include #include "OBSWConfig.h" +#include "mission/trace.h" #include "fsfw/container/FIFO.h" #include "fsfw/devicehandlers/CookieIF.h" #include "fsfw/objectmanager/SystemObject.h" @@ -15,6 +16,7 @@ #include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw_hal/linux/serial/SerialComIF.h" #include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h" +#include "mission/trace.h" #include "tas/crc.h" #ifdef XIPHOS_Q7S @@ -211,6 +213,9 @@ class PlocSupvUartManager : public DeviceCommunicationIF, supv::TmBase tmReader; int serialPort = 0; struct termios tty = {}; +#if OBSW_THREAD_TRACING == 1 + uint32_t opCounter = 0; +#endif struct EventBufferRequest { std::string path = ""; diff --git a/mission/controller/AcsController.cpp b/mission/controller/AcsController.cpp index 72589fcc..051fa8f0 100644 --- a/mission/controller/AcsController.cpp +++ b/mission/controller/AcsController.cpp @@ -4,7 +4,6 @@ #include "mission/acsDefs.h" #include "mission/config/torquer.h" -#include "mission/trace.h" AcsController::AcsController(object_id_t objectId) : ExtendedControllerBase(objectId), diff --git a/mission/controller/AcsController.h b/mission/controller/AcsController.h index 14972b3e..f5240b74 100644 --- a/mission/controller/AcsController.h +++ b/mission/controller/AcsController.h @@ -6,7 +6,6 @@ #include #include -#include "OBSWConfig.h" #include "acs/ActuatorCmd.h" #include "acs/Guidance.h" #include "acs/Navigation.h" @@ -20,6 +19,7 @@ #include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "mission/devices/devicedefinitions/SusDefinitions.h" #include "mission/devices/devicedefinitions/imtqHandlerDefinitions.h" +#include "mission/trace.h" class AcsController : public ExtendedControllerBase, public ReceivesParameterMessagesIF { public: diff --git a/mission/devices/BpxBatteryHandler.cpp b/mission/devices/BpxBatteryHandler.cpp index efda26f8..922bcd3b 100644 --- a/mission/devices/BpxBatteryHandler.cpp +++ b/mission/devices/BpxBatteryHandler.cpp @@ -2,8 +2,6 @@ #include -#include "mission/trace.h" - BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie) : DeviceHandlerBase(objectId, comIF, comCookie), hkSet(this), cfgSet(this) {} diff --git a/mission/devices/BpxBatteryHandler.h b/mission/devices/BpxBatteryHandler.h index 31448799..c42ed7fd 100644 --- a/mission/devices/BpxBatteryHandler.h +++ b/mission/devices/BpxBatteryHandler.h @@ -3,8 +3,8 @@ #include -#include "OBSWConfig.h" #include "devicedefinitions/BpxBatteryDefinitions.h" +#include "mission/trace.h" class BpxBatteryHandler : public DeviceHandlerBase { public: diff --git a/mission/devices/SolarArrayDeploymentHandler.cpp b/mission/devices/SolarArrayDeploymentHandler.cpp index 2eacdea4..cb8658bc 100644 --- a/mission/devices/SolarArrayDeploymentHandler.cpp +++ b/mission/devices/SolarArrayDeploymentHandler.cpp @@ -11,6 +11,7 @@ #include "fsfw/ipc/QueueFactory.h" #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw_hal/common/gpio/GpioCookie.h" +#include "mission/trace.h" static constexpr bool DEBUG_MODE = true; diff --git a/mission/devices/SolarArrayDeploymentHandler.h b/mission/devices/SolarArrayDeploymentHandler.h index 27c466f1..61211ca3 100644 --- a/mission/devices/SolarArrayDeploymentHandler.h +++ b/mission/devices/SolarArrayDeploymentHandler.h @@ -19,6 +19,7 @@ #include "fsfw/timemanager/Countdown.h" #include "fsfw_hal/common/gpio/GpioIF.h" #include "mission/memory/SdCardMountedIF.h" +#include "mission/trace.h" #include "returnvalues/classIds.h" enum DeploymentChannels : uint8_t { SA_1 = 1, SA_2 = 2 }; @@ -173,7 +174,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF, ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID; std::optional initUptime; #if OBSW_THREAD_TRACING == 1 - uint32_t opCounter; + uint32_t opCounter = 0; #endif PeriodicOperationDivider opDivider = PeriodicOperationDivider(5); uint8_t retryCounter = 3; diff --git a/mission/trace.h b/mission/trace.h index a3fabbd9..6f20a698 100644 --- a/mission/trace.h +++ b/mission/trace.h @@ -3,6 +3,8 @@ #include +#define OBSW_THREAD_TRACING 1 + namespace trace { void threadTrace(uint32_t& counter, const char* name);