system_load:Track Dynamic PID hash

This commit is contained in:
David Sidrane
2021-08-13 14:22:00 -04:00
committed by Daniel Agar
parent e6d9c2b734
commit bb913ae11a
53 changed files with 58 additions and 58 deletions
@@ -45,8 +45,8 @@
#include <stdint.h>
#ifndef CONFIG_MAX_TASKS
#define CONFIG_MAX_TASKS 64
#ifndef CONFIG_FS_PROCFS_MAX_TASKS
#define CONFIG_FS_PROCFS_MAX_TASKS 64
#endif
struct print_load_s {
@@ -57,7 +57,7 @@ struct print_load_s {
uint64_t new_time{0};
uint64_t interval_start_time{0};
uint64_t last_times[CONFIG_MAX_TASKS] {};
uint64_t last_times[CONFIG_FS_PROCFS_MAX_TASKS] {};
float interval_time_us{0.f};
};
+1 -1
View File
@@ -61,7 +61,7 @@ void cpuload_monitor_start()
system_load.start_time = hrt_absolute_time();
for (int i = 1; i < CONFIG_MAX_TASKS; i++) {
for (int i = 1; i < CONFIG_FS_PROCFS_MAX_TASKS; i++) {
system_load.tasks[i].total_runtime = 0;
system_load.tasks[i].curr_start_time = 0;
}
@@ -48,7 +48,7 @@ struct system_load_taskinfo_s {
struct system_load_s {
uint64_t start_time{0};
system_load_taskinfo_s tasks[CONFIG_MAX_TASKS] {};
system_load_taskinfo_s tasks[CONFIG_FS_PROCFS_MAX_TASKS] {};
int total_count{0};
int running_count{0};
bool initialized{false};
@@ -81,7 +81,7 @@ void init_print_load(struct print_load_s *s)
s->last_times[0] = system_load.tasks[0].total_runtime;
sched_unlock();
for (int i = 1; i < CONFIG_MAX_TASKS; i++) {
for (int i = 1; i < CONFIG_FS_PROCFS_MAX_TASKS; i++) {
s->last_times[i] = 0;
}
@@ -142,12 +142,12 @@ void print_load_buffer(char *buffer, int buffer_length, print_load_callback_f cb
float idle_load = 0.f;
// create a copy of the runtimes because this could be updated during the print output
uint64_t total_runtime[CONFIG_MAX_TASKS] {};
uint64_t total_runtime[CONFIG_FS_PROCFS_MAX_TASKS] {};
sched_lock();
print_state->new_time = hrt_absolute_time();
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
for (int i = 0; i < CONFIG_FS_PROCFS_MAX_TASKS; i++) {
if (system_load.tasks[i].valid) {
total_runtime[i] = system_load.tasks[i].total_runtime;
}
@@ -182,7 +182,7 @@ void print_load_buffer(char *buffer, int buffer_length, print_load_callback_f cb
print_state->total_user_time = 0;
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
for (int i = 0; i < CONFIG_FS_PROCFS_MAX_TASKS; i++) {
sched_lock(); // need to lock the tcb access (but make it as short as possible)