paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [5271] remove cpu_load computation for booz again.


From: Felix Ruess
Subject: [paparazzi-commits] [5271] remove cpu_load computation for booz again.
Date: Fri, 06 Aug 2010 19:07:28 +0000

Revision: 5271
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5271
Author:   flixr
Date:     2010-08-06 19:07:28 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
remove cpu_load computation for booz again. The sys_mon module provides a 
cleaner way.

Modified Paths:
--------------
    paparazzi3/trunk/conf/airframes/booz2_flixr.xml
    paparazzi3/trunk/conf/messages.xml
    paparazzi3/trunk/sw/airborne/booz/booz2_main.c
    paparazzi3/trunk/sw/airborne/booz/booz2_telemetry.h

Modified: paparazzi3/trunk/conf/airframes/booz2_flixr.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/booz2_flixr.xml     2010-08-06 18:01:48 UTC 
(rev 5270)
+++ paparazzi3/trunk/conf/airframes/booz2_flixr.xml     2010-08-06 19:07:28 UTC 
(rev 5271)
@@ -246,8 +246,6 @@
         ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c
         sim.srcs += $(SRC_BOOZ_SIM)/booz2_pwm_hw.c
 
-        #ap.CFLAGS += -DCALC_CPU_LOAD
-
         ap.CFLAGS += -DUSE_MODULES
         sim.CFLAGS += -DUSE_MODULES
 

Modified: paparazzi3/trunk/conf/messages.xml
===================================================================
--- paparazzi3/trunk/conf/messages.xml  2010-08-06 18:01:48 UTC (rev 5270)
+++ paparazzi3/trunk/conf/messages.xml  2010-08-06 19:07:28 UTC (rev 5271)
@@ -1525,9 +1525,7 @@
       <field name="ap_h_mode"    type="uint8" 
values="KILL|RATE|ATTITUDE|HOVER|NAV"/>
       <field name="ap_v_mode"    type="uint8" 
values="KILL|RC_DIRECT|RC_CLIMB|CLIMB|HOVER|NAV"/>
       <field name="vsupply"      type="uint8" unit="decivolt"/>
-      <field name="cpu_time"     type="uint16" unit="s"/>
-      <field name="cpu_load_avg" type="uint8" unit="%"/>
-      <field name="cpu_load_max" type="uint8" unit="%"/>
+      <field name="cpu_time"     type="uint16" unit="s"></field>
   </message>
 
   <message name="BOOZ_SIM_RPMS" id="239">

Modified: paparazzi3/trunk/sw/airborne/booz/booz2_main.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/booz2_main.c      2010-08-06 18:01:48 UTC 
(rev 5270)
+++ paparazzi3/trunk/sw/airborne/booz/booz2_main.c      2010-08-06 19:07:28 UTC 
(rev 5271)
@@ -68,8 +68,6 @@
 #endif
 
 uint32_t startup_counter = 0;
-uint8_t cpu_load_avg = 0;
-uint8_t cpu_load_max = 0;
 
 static inline void on_gyro_accel_event( void );
 static inline void on_baro_event( void );
@@ -77,47 +75,16 @@
 static inline void on_mag_event( void );
 
 #ifndef SITL
-#ifdef CALC_CPU_LOAD
-/* estimate of time needed in idle main_event taks (no pending events) in TOTC 
ticks */
-uint32_t main_event_idle_ticks = PERIODIC_TASK_PERIOD;
-
 int main( void ) {
-  uint32_t load_counter = 0;
-  uint8_t cpu_load = 0;
-  uint8_t cpu_load_max_tmp = 0;
-  uint16_t cpu_load_avg_sum = 0;
-
   booz2_main_init();
 
   while(1) {
-    if (sys_time_periodic()) {
-      cpu_load = 100*(PERIODIC_TASK_PERIOD - 
(load_counter-1)*main_event_idle_ticks) / PERIODIC_TASK_PERIOD;
-      if (cpu_load > cpu_load_max_tmp)
-        cpu_load_max_tmp = cpu_load;
-      cpu_load_avg_sum += cpu_load;
-
-      booz2_main_periodic();
-
-      load_counter = 0;
-      RunOnceEvery(512, {cpu_load_avg=cpu_load_avg_sum/512; 
cpu_load_max=cpu_load_max_tmp; cpu_load_avg_sum=0; cpu_load_max_tmp=0;});
-    }
-    load_counter++;
-    booz2_main_event();
-  }
-  return 0;
-}
-#else // Do not calculate cpu load
-int main( void ) {
-  booz2_main_init();
-
-  while(1) {
     if (sys_time_periodic())
       booz2_main_periodic();
     booz2_main_event();
   }
   return 0;
 }
-#endif /* CALC_CPU_LOAD */
 #endif /* SITL */
 
 #ifdef BOOZ_START_DELAY
@@ -229,10 +196,6 @@
 }
 
 STATIC_INLINE void booz2_main_event( void ) {
-#ifdef CALC_CPU_LOAD
-  /* start estimation of ticks needed if no events are processed */
-  SysTimeChronoStart();
-#endif
 
   DatalinkEvent();
 
@@ -256,12 +219,6 @@
   modules_event_task();
 #endif
 
-#ifdef CALC_CPU_LOAD
-  /* remember lowest value -> no events processed */
-  SysTimeChronoStop();
-  if (sys_time_chrono < main_event_idle_ticks)
-    main_event_idle_ticks = sys_time_chrono;
-#endif
 }
 
 static inline void on_gyro_accel_event( void ) {

Modified: paparazzi3/trunk/sw/airborne/booz/booz2_telemetry.h
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/booz2_telemetry.h 2010-08-06 18:01:48 UTC 
(rev 5270)
+++ paparazzi3/trunk/sw/airborne/booz/booz2_telemetry.h 2010-08-06 19:07:28 UTC 
(rev 5271)
@@ -56,45 +56,41 @@
 extern uint8_t telemetry_mode_Main_DefaultChannel;
 
 #ifdef USE_GPS
-#define PERIODIC_SEND_BOOZ_STATUS(_chan) {                  \
-    uint32_t booz_imu_nb_err = 0;                           \
-    uint8_t _twi_blmc_nb_err = 0;                           \
-    DOWNLINK_SEND_BOOZ_STATUS(_chan,                        \
-                              &booz_imu_nb_err,             \
-                              &_twi_blmc_nb_err,            \
-                              &radio_control.status,        \
-                              &booz_gps_state.fix,          \
-                              &booz2_autopilot_mode,        \
-                              &booz2_autopilot_in_flight,   \
-                              &booz2_autopilot_motors_on,   \
-                              &booz2_guidance_h_mode,       \
-                              &booz2_guidance_v_mode,       \
-                              &booz2_battery_voltage,       \
-                              &cpu_time_sec,                \
-                              &cpu_load_avg,                \
-                              &cpu_load_max                 \
-                              );                            \
+#define PERIODIC_SEND_BOOZ_STATUS(_chan) {                             \
+    uint32_t booz_imu_nb_err = 0;                                      \
+    uint8_t _twi_blmc_nb_err = 0;                                      \
+    DOWNLINK_SEND_BOOZ_STATUS(_chan,                                   \
+                             &booz_imu_nb_err,                         \
+                             &_twi_blmc_nb_err,                        \
+                             &radio_control.status,                    \
+                             &booz_gps_state.fix,                      \
+                             &booz2_autopilot_mode,                    \
+                             &booz2_autopilot_in_flight,               \
+                             &booz2_autopilot_motors_on,               \
+                             &booz2_guidance_h_mode,                   \
+                             &booz2_guidance_v_mode,                   \
+                             &booz2_battery_voltage,                   \
+                             &cpu_time_sec                             \
+                             );                                        \
   }
 #else /* !USE_GPS */
-#define PERIODIC_SEND_BOOZ_STATUS(_chan) {                  \
-    uint32_t booz_imu_nb_err = 0;                           \
-    uint8_t twi_blmc_nb_err = 0;                            \
-    uint8_t  fix = BOOZ2_GPS_FIX_NONE;                      \
-    DOWNLINK_SEND_BOOZ_STATUS(_chan,                        \
-                              &booz_imu_nb_err,             \
-                              &twi_blmc_nb_err,             \
-                              &radio_control.status,        \
-                              &fix,                         \
-                              &booz2_autopilot_mode,        \
-                              &booz2_autopilot_in_flight,   \
-                              &booz2_autopilot_motors_on,   \
-                              &booz2_guidance_h_mode,       \
-                              &booz2_guidance_v_mode,       \
-                              &booz2_battery_voltage,       \
-                              &cpu_time_sec,                \
-                              &cpu_load_avg,                \
-                              &cpu_load_max                 \
-                              );                            \
+#define PERIODIC_SEND_BOOZ_STATUS(_chan) {                             \
+    uint32_t booz_imu_nb_err = 0;                                      \
+    uint8_t twi_blmc_nb_err = 0;                                       \
+    uint8_t  fix = BOOZ2_GPS_FIX_NONE;                                 \
+    DOWNLINK_SEND_BOOZ_STATUS(_chan,                                   \
+                             &booz_imu_nb_err,                         \
+                             &twi_blmc_nb_err,                         \
+                             &radio_control.status,                    \
+                             &fix,                                     \
+                             &booz2_autopilot_mode,                    \
+                             &booz2_autopilot_in_flight,               \
+                             &booz2_autopilot_motors_on,               \
+                             &booz2_guidance_h_mode,                   \
+                             &booz2_guidance_v_mode,                   \
+                             &booz2_battery_voltage,                   \
+                             &cpu_time_sec                             \
+                             );                                        \
   }
 #endif /* USE_GPS */
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]