@@ -29,7 +29,9 | |||
|
29 | 29 | |
|
30 | 30 | unsigned char lfr_rtems_cpu_usage_report( void ); |
|
31 | 31 | |
|
32 | #define CONST_10 10 | |
|
32 | 33 | #define CONST_100 100 |
|
34 | #define CONST_255 255 | |
|
33 | 35 | #define CONST_1000 1000 |
|
34 | 36 | #define CONST_100000 100000 |
|
35 | 37 |
@@ -64,7 +64,7 option(FSW_debug_tch "?" OFF) | |||
|
64 | 64 | set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE) |
|
65 | 65 | set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE) |
|
66 | 66 | set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE) |
|
67 |
set(SW_VERSION_N4 "1 |
|
|
67 | set(SW_VERSION_N4 "19" CACHE STRING "Choose N4 FSW Version." FORCE) | |
|
68 | 68 | |
|
69 | 69 | if(FSW_verbose) |
|
70 | 70 | add_definitions(-DPRINT_MESSAGES_ON_CONSOLE) |
@@ -816,7 +816,7 void get_cpu_load( unsigned char *resour | |||
|
816 | 816 | old_avg_pos %= LOAD_AVG_SIZE; |
|
817 | 817 | // CPU_LOAD_AVE |
|
818 | 818 | resource_statistics[BYTE_2] = (unsigned char)(cpu_load_avg / LOAD_AVG_SIZE); |
|
819 | ||
|
819 | // this will change the way LFR compute usage | |
|
820 | 820 | #ifndef PRINT_TASK_STATISTICS |
|
821 | 821 | rtems_cpu_usage_reset(); |
|
822 | 822 | #endif |
@@ -28,11 +28,7 unsigned char lfr_rtems_cpu_usage_report | |||
|
28 | 28 | Timestamp_Control uptime; |
|
29 | 29 | Timestamp_Control total; |
|
30 | 30 | Timestamp_Control ran; |
|
31 | Timestamp_Control abs_total; | |
|
32 | Timestamp_Control abs_ran; | |
|
33 | 31 | |
|
34 | static Timestamp_Control last_total={0,0}; | |
|
35 | static Timestamp_Control last_ran={0,0}; | |
|
36 | 32 | #else |
|
37 | 33 | #error "Can't compute CPU usage using ticks on LFR" |
|
38 | 34 | #endif |
@@ -42,8 +38,6 unsigned char lfr_rtems_cpu_usage_report | |||
|
42 | 38 | ival = 0; |
|
43 | 39 | cpu_load = 0; |
|
44 | 40 | |
|
45 | _TOD_Get_uptime( &uptime ); | |
|
46 | _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &abs_total ); | |
|
47 | 41 | for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) |
|
48 | 42 | { |
|
49 | 43 | if ( !_Objects_Information_table[ api_index ] ) { } |
@@ -59,30 +53,11 unsigned char lfr_rtems_cpu_usage_report | |||
|
59 | 53 | if ( the_thread == NULL) { } |
|
60 | 54 | else if(the_thread->Object.id == Task_id[TASKID_SCRB]) // Only measure scrubbing task load, CPU load is 100%-Scrubbing |
|
61 | 55 | { |
|
62 |
|
|
|
63 | * If this is the currently executing thread, account for time | |
|
64 | * since the last context switch. | |
|
65 | */ | |
|
66 | abs_ran = the_thread->cpu_time_used; | |
|
67 | if ( _Thread_Executing->Object.id == the_thread->Object.id ) | |
|
68 | { | |
|
69 | Timestamp_Control used; | |
|
70 | _Timestamp_Subtract( | |
|
71 | &_Thread_Time_of_last_context_switch, &uptime, &used | |
|
72 | ); | |
|
73 | _Timestamp_Add_to( &abs_ran, &used ); | |
|
74 | } | |
|
75 | /* | |
|
76 | * Only consider the time since last call | |
|
77 | */ | |
|
78 | _Timespec_Subtract(&last_ran, &abs_ran, &ran); | |
|
79 | _Timespec_Subtract(&last_total, &abs_total, &total); | |
|
80 | ||
|
81 | last_ran = abs_ran; | |
|
82 | last_total = abs_total; | |
|
83 | ||
|
56 | _TOD_Get_uptime( &uptime ); | |
|
57 | _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total ); | |
|
58 | ran = the_thread->cpu_time_used; | |
|
84 | 59 | _Timestamp_Divide( &ran, &total, &ival, &fval); |
|
85 |
cpu_load = (unsigned char)(CONST_ |
|
|
60 | cpu_load = (unsigned char)(CONST_255 - ((ival*CONST_10+fval/CONST_100)*CONST_256/CONST_1000)); | |
|
86 | 61 | } |
|
87 | 62 | } |
|
88 | 63 | } |
General Comments 0
You need to be logged in to leave comments.
Login now