Skip to content

Commit b66b7fa

Browse files
authored
fix(monitor): properly display no core affinity as -1 (#232)
* Fixed bug in task monitor which returned core_id natively, meaning that tskNO_AFFINITY would be returned as a very large number instead of -1. Now it checks that value specifically and converts it to -1 for simpler display * Simplified cdoe for returning task info since both cases were doing the same thing
1 parent 46c9f50 commit b66b7fa

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

components/monitor/include/task_monitor.hpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,13 @@ class TaskMonitor : public BaseComponent {
131131
int core_id = -2; // -2 is the default value if core id is not available
132132
#if CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID
133133
core_id = pxTaskStatusArray[x].xCoreID;
134+
if (core_id == tskNO_AFFINITY) {
135+
core_id = -1;
136+
}
134137
#endif
135138

136-
if (ulStatsAsPercentage > 0UL) {
137-
task_info.push_back({pxTaskStatusArray[x].pcTaskName, ulStatsAsPercentage,
138-
high_water_mark, priority, core_id});
139-
} else {
140-
// If the percentage is zero here then the task has
141-
// consumed less than 1% of the total run time.
142-
task_info.push_back(
143-
{pxTaskStatusArray[x].pcTaskName, 0, high_water_mark, priority, core_id});
144-
}
139+
task_info.push_back({pxTaskStatusArray[x].pcTaskName, ulStatsAsPercentage,
140+
high_water_mark, priority, core_id});
145141
}
146142
}
147143
// The array is no longer needed, free the memory it consumes.

0 commit comments

Comments
 (0)