Thread Tracing and Scheduling Update #379
@ -77,6 +77,7 @@
|
|||||||
// If this is enabled, all other I2C code should be disabled
|
// If this is enabled, all other I2C code should be disabled
|
||||||
#define OBSW_ADD_I2C_TEST_CODE 0
|
#define OBSW_ADD_I2C_TEST_CODE 0
|
||||||
#define OBSW_ADD_UART_TEST_CODE 0
|
#define OBSW_ADD_UART_TEST_CODE 0
|
||||||
|
#define OBSW_THREAD_TRACING 1
|
||||||
|
|
||||||
#define OBSW_TEST_ACS 0
|
#define OBSW_TEST_ACS 0
|
||||||
#define OBSW_DEBUG_ACS 0
|
#define OBSW_DEBUG_ACS 0
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
#include "fsfw/version.h"
|
#include "fsfw/version.h"
|
||||||
|
#include "mission/trace.h"
|
||||||
#include "watchdog/definitions.h"
|
#include "watchdog/definitions.h"
|
||||||
#if OBSW_ADD_TMTC_UDP_SERVER == 1
|
#if OBSW_ADD_TMTC_UDP_SERVER == 1
|
||||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||||
@ -63,6 +64,9 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::performControlOperation() {
|
void CoreController::performControlOperation() {
|
||||||
|
#if OBSW_THREAD_TRACING == 1
|
||||||
|
trace::threadTrace(opCounter, "CORE CTRL");
|
||||||
|
#endif
|
||||||
EventMessage event;
|
EventMessage event;
|
||||||
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
||||||
result = eventQueue->receiveMessage(&event)) {
|
result = eventQueue->receiveMessage(&event)) {
|
||||||
|
@ -222,6 +222,9 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
std::string currMntPrefix;
|
std::string currMntPrefix;
|
||||||
bool performOneShotSdCardOpsSwitch = false;
|
bool performOneShotSdCardOpsSwitch = false;
|
||||||
uint8_t shortSdCardCdCounter = 0;
|
uint8_t shortSdCardCdCounter = 0;
|
||||||
|
#if OBSW_THREAD_TRACING == 1
|
||||||
|
uint32_t opCounter;
|
||||||
|
#endif
|
||||||
Countdown sdCardCheckCd = Countdown(INIT_SD_CARD_CHECK_TIMEOUT);
|
Countdown sdCardCheckCd = Countdown(INIT_SD_CARD_CHECK_TIMEOUT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -374,9 +374,9 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction
|
|||||||
#else
|
#else
|
||||||
static constexpr float acsPstPeriod = 0.8;
|
static constexpr float acsPstPeriod = 0.8;
|
||||||
#endif
|
#endif
|
||||||
FixedTimeslotTaskIF* acsPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* acsTcsPst = factory.createFixedTimeslotTask(
|
||||||
"ACS_PST", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, acsPstPeriod, missedDeadlineFunc);
|
"ACS_TCS_PST", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, acsPstPeriod, missedDeadlineFunc);
|
||||||
result = pst::pstTcsAndAcs(acsPst, cfg);
|
result = pst::pstTcsAndAcs(acsTcsPst, cfg);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::warning << "scheduling::initTasks: ACS PST is empty" << std::endl;
|
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;
|
sif::error << "scheduling::initTasks: Creating ACS PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
taskVec.push_back(acsPst);
|
taskVec.push_back(acsTcsPst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Polling Sequence Table Default */
|
/* Polling Sequence Table Default */
|
||||||
|
@ -9,4 +9,4 @@ add_subdirectory(csp)
|
|||||||
add_subdirectory(cfdp)
|
add_subdirectory(cfdp)
|
||||||
add_subdirectory(config)
|
add_subdirectory(config)
|
||||||
|
|
||||||
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp)
|
target_sources(${LIB_EIVE_MISSION} PRIVATE acsDefs.cpp trace.cpp)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "mission/acsDefs.h"
|
#include "mission/acsDefs.h"
|
||||||
#include "mission/config/torquer.h"
|
#include "mission/config/torquer.h"
|
||||||
|
#include "mission/trace.h"
|
||||||
|
|
||||||
AcsController::AcsController(object_id_t objectId)
|
AcsController::AcsController(object_id_t objectId)
|
||||||
: ExtendedControllerBase(objectId),
|
: ExtendedControllerBase(objectId),
|
||||||
@ -50,6 +51,9 @@ ReturnValue_t AcsController::getParameter(uint8_t domainId, uint8_t parameterId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AcsController::performControlOperation() {
|
void AcsController::performControlOperation() {
|
||||||
|
#if OBSW_THREAD_TRACING == 1
|
||||||
|
trace::threadTrace(opCounter, "ACS & TCS PST");
|
||||||
|
#endif
|
||||||
switch (internalState) {
|
switch (internalState) {
|
||||||
case InternalState::STARTUP: {
|
case InternalState::STARTUP: {
|
||||||
initialCountdown.resetTimer();
|
initialCountdown.resetTimer();
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <fsfw/parameters/ParameterHelper.h>
|
#include <fsfw/parameters/ParameterHelper.h>
|
||||||
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
#include "acs/ActuatorCmd.h"
|
#include "acs/ActuatorCmd.h"
|
||||||
#include "acs/Guidance.h"
|
#include "acs/Guidance.h"
|
||||||
#include "acs/Navigation.h"
|
#include "acs/Navigation.h"
|
||||||
@ -51,6 +52,10 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
|||||||
|
|
||||||
ParameterHelper parameterHelper;
|
ParameterHelper parameterHelper;
|
||||||
|
|
||||||
|
#if OBSW_THREAD_TRACING == 1
|
||||||
|
uint32_t opCounter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
|
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
|
||||||
|
|
||||||
InternalState internalState = InternalState::STARTUP;
|
InternalState internalState = InternalState::STARTUP;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "mission/trace.h"
|
||||||
|
|
||||||
BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
|
BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie), hkSet(this), cfgSet(this) {}
|
: 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::setDebugMode(bool enable) { this->debugMode = enable; }
|
||||||
|
|
||||||
|
void BpxBatteryHandler::performOperationHook() {
|
||||||
|
#if OBSW_THREAD_TRACING == 1
|
||||||
|
trace::threadTrace(opCounter, "BPX BATT");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
#include "devicedefinitions/BpxBatteryDefinitions.h"
|
#include "devicedefinitions/BpxBatteryDefinitions.h"
|
||||||
|
|
||||||
class BpxBatteryHandler : public DeviceHandlerBase {
|
class BpxBatteryHandler : public DeviceHandlerBase {
|
||||||
@ -24,6 +25,10 @@ class BpxBatteryHandler : public DeviceHandlerBase {
|
|||||||
bool debugMode = false;
|
bool debugMode = false;
|
||||||
bool goToNormalModeImmediately = false;
|
bool goToNormalModeImmediately = false;
|
||||||
uint8_t sentPingByte = BpxBattery::DEFAULT_PING_SENT_BYTE;
|
uint8_t sentPingByte = BpxBattery::DEFAULT_PING_SENT_BYTE;
|
||||||
|
#if OBSW_THREAD_TRACING == 1
|
||||||
|
uint32_t opCounter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
BpxBatteryHk hkSet;
|
BpxBatteryHk hkSet;
|
||||||
DeviceCommandId_t lastCmd = DeviceHandlerIF::NO_COMMAND_ID;
|
DeviceCommandId_t lastCmd = DeviceHandlerIF::NO_COMMAND_ID;
|
||||||
BpxBatteryCfg cfgSet;
|
BpxBatteryCfg cfgSet;
|
||||||
@ -47,6 +52,7 @@ class BpxBatteryHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
void fillCommandAndReplyMap() override;
|
void fillCommandAndReplyMap() override;
|
||||||
|
void performOperationHook() override;
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||||
size_t commandDataLen) override;
|
size_t commandDataLen) override;
|
||||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||||
|
@ -37,6 +37,12 @@ SolarArrayDeploymentHandler::~SolarArrayDeploymentHandler() = default;
|
|||||||
|
|
||||||
ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) {
|
ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) {
|
||||||
using namespace std::filesystem;
|
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()) {
|
if (opDivider.checkAndIncrement()) {
|
||||||
auto activeSdc = sdcMan.getActiveSdCard();
|
auto activeSdc = sdcMan.getActiveSdCard();
|
||||||
if (activeSdc and activeSdc.value() == sd::SdCard::SLOT_0 and
|
if (activeSdc and activeSdc.value() == sd::SdCard::SLOT_0 and
|
||||||
|
@ -172,6 +172,9 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
bool firstAutonomousCycle = true;
|
bool firstAutonomousCycle = true;
|
||||||
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
|
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
|
||||||
std::optional<uint64_t> initUptime;
|
std::optional<uint64_t> initUptime;
|
||||||
|
#if OBSW_THREAD_TRACING == 1
|
||||||
|
uint32_t opCounter;
|
||||||
|
#endif
|
||||||
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
|
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
|
||||||
uint8_t retryCounter = 3;
|
uint8_t retryCounter = 3;
|
||||||
|
|
||||||
|
10
mission/trace.cpp
Normal file
10
mission/trace.cpp
Normal 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
12
mission/trace.h
Normal 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_ */
|
Loading…
x
Reference in New Issue
Block a user