add tracing for first tasks
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2023-02-14 10:59:35 +01:00
parent a75e035cc5
commit 66d20dc118
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
13 changed files with 66 additions and 6 deletions

View File

@ -77,6 +77,7 @@
// 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

View File

@ -9,6 +9,7 @@
#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"
@ -63,6 +64,9 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
}
void CoreController::performControlOperation() {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "CORE CTRL");
#endif
EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) {

View File

@ -222,6 +222,9 @@ class CoreController : public ExtendedControllerBase {
std::string currMntPrefix;
bool performOneShotSdCardOpsSwitch = false;
uint8_t shortSdCardCdCounter = 0;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter;
#endif
Countdown sdCardCheckCd = Countdown(INIT_SD_CARD_CHECK_TIMEOUT);
/**

View File

@ -374,9 +374,9 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
#else
static constexpr float acsPstPeriod = 0.8;
#endif
FixedTimeslotTaskIF* acsPst = factory.createFixedTimeslotTask(
"ACS_PST", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, acsPstPeriod, missedDeadlineFunc);
result = pst::pstTcsAndAcs(acsPst, cfg);
FixedTimeslotTaskIF* acsTcsPst = factory.createFixedTimeslotTask(
"ACS_TCS_PST", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, acsPstPeriod, missedDeadlineFunc);
result = pst::pstTcsAndAcs(acsTcsPst, cfg);
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "scheduling::initTasks: ACS PST is empty" << std::endl;
@ -384,7 +384,7 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
sif::error << "scheduling::initTasks: Creating ACS PST failed!" << std::endl;
}
} else {
taskVec.push_back(acsPst);
taskVec.push_back(acsTcsPst);
}
/* Polling Sequence Table Default */

View File

@ -9,4 +9,4 @@ add_subdirectory(csp)
add_subdirectory(cfdp)
add_subdirectory(config)
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp)
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp trace.cpp)

View File

@ -4,6 +4,7 @@
#include "mission/acsDefs.h"
#include "mission/config/torquer.h"
#include "mission/trace.h"
AcsController::AcsController(object_id_t objectId)
: ExtendedControllerBase(objectId),
@ -50,6 +51,9 @@ ReturnValue_t AcsController::getParameter(uint8_t domainId, uint8_t parameterId,
}
void AcsController::performControlOperation() {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "ACS & TCS PST");
#endif
switch (internalState) {
case InternalState::STARTUP: {
initialCountdown.resetTimer();

View File

@ -6,6 +6,7 @@
#include <fsfw/parameters/ParameterHelper.h>
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
#include "OBSWConfig.h"
#include "acs/ActuatorCmd.h"
#include "acs/Guidance.h"
#include "acs/Navigation.h"
@ -51,6 +52,10 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
ParameterHelper parameterHelper;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
InternalState internalState = InternalState::STARTUP;

View File

@ -2,7 +2,7 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include "OBSWConfig.h"
#include "mission/trace.h"
BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
: DeviceHandlerBase(objectId, comIF, comCookie), hkSet(this), cfgSet(this) {}
@ -280,3 +280,9 @@ void BpxBatteryHandler::setToGoToNormalMode(bool enable) {
}
void BpxBatteryHandler::setDebugMode(bool enable) { this->debugMode = enable; }
void BpxBatteryHandler::performOperationHook() {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "BPX BATT");
#endif
}

View File

@ -3,6 +3,7 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include "OBSWConfig.h"
#include "devicedefinitions/BpxBatteryDefinitions.h"
class BpxBatteryHandler : public DeviceHandlerBase {
@ -24,6 +25,10 @@ class BpxBatteryHandler : public DeviceHandlerBase {
bool debugMode = false;
bool goToNormalModeImmediately = false;
uint8_t sentPingByte = BpxBattery::DEFAULT_PING_SENT_BYTE;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter = 0;
#endif
BpxBatteryHk hkSet;
DeviceCommandId_t lastCmd = DeviceHandlerIF::NO_COMMAND_ID;
BpxBatteryCfg cfgSet;
@ -47,6 +52,7 @@ class BpxBatteryHandler : public DeviceHandlerBase {
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
void fillCommandAndReplyMap() override;
void performOperationHook() override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,

View File

@ -37,6 +37,12 @@ SolarArrayDeploymentHandler::~SolarArrayDeploymentHandler() = default;
ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) {
using namespace std::filesystem;
#if OBSW_THREAD_TRACING == 1
opCounter++;
if (opCounter % 5 == 0) {
sif::debug << "SA DEPL task running" << std::endl;
}
#endif
if (opDivider.checkAndIncrement()) {
auto activeSdc = sdcMan.getActiveSdCard();
if (activeSdc and activeSdc.value() == sd::SdCard::SLOT_0 and

View File

@ -172,6 +172,9 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
bool firstAutonomousCycle = true;
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
std::optional<uint64_t> initUptime;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter;
#endif
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
uint8_t retryCounter = 3;

10
mission/trace.cpp Normal file
View File

@ -0,0 +1,10 @@
#include "trace.h"
#include "fsfw/serviceinterface.h"
void trace::threadTrace(uint32_t& counter, const char* name) {
counter++;
if (counter % 5 == 0) {
sif::debug << name << " running" << std::endl;
}
}

12
mission/trace.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef MISSION_TRACE_H_
#define MISSION_TRACE_H_
#include <cstdint>
namespace trace {
void threadTrace(uint32_t& counter, const char* name);
}
#endif /* MISSION_TRACE_H_ */