Removed state machine cycle time measuring.
authorFlorian Pose <fp@igh-essen.com>
Thu, 19 Jun 2008 10:22:24 +0000
changeset 1041 42c9ac58d9ce
parent 1040 d2527675cdd5
child 1042 60bb49e4c985
Removed state machine cycle time measuring.
TODO
master/master.c
master/master.h
--- a/TODO	Thu Jun 19 10:18:58 2008 +0000
+++ b/TODO	Thu Jun 19 10:22:24 2008 +0000
@@ -13,7 +13,6 @@
 * READMEs for examples.
 * Update documentation.
 * Attach Pdo names from SII or Coe dictioary to Pdos read via CoE.
-* Remove Eoe cycles and Idle cycles.
 
 Future issues:
 
--- a/master/master.c	Thu Jun 19 10:18:58 2008 +0000
+++ b/master/master.c	Thu Jun 19 10:22:24 2008 +0000
@@ -82,8 +82,6 @@
         struct class *class /**< Device class. */
         )
 {
-    unsigned int i;
-
     master->index = index;
     master->reserved = 0;
 
@@ -122,16 +120,7 @@
     master->stats.output_jiffies = 0;
     master->frames_timed_out = 0;
 
-    for (i = 0; i < HZ; i++) {
-        master->idle_cycle_times[i] = 0;
-#ifdef EC_EOE
-        master->eoe_cycle_times[i] = 0;
-#endif
-    }
-    master->idle_cycle_time_pos = 0;
-#ifdef EC_EOE
-    master->eoe_cycle_time_pos = 0;
-
+#ifdef EC_EOE
     init_timer(&master->eoe_timer);
     master->eoe_timer.function = ec_master_eoe_run;
     master->eoe_timer.data = (unsigned long) master;
@@ -822,13 +811,10 @@
  */
 static int ec_master_idle_thread(ec_master_t *master)
 {
-    cycles_t cycles_start, cycles_end;
-
     daemonize("EtherCAT-IDLE");
     allow_signal(SIGTERM);
 
     while (!signal_pending(current)) {
-        cycles_start = get_cycles();
         ec_datagram_output_stats(&master->fsm_datagram);
 
         // receive
@@ -848,12 +834,6 @@
         ecrt_master_send(master);
         spin_unlock_bh(&master->internal_lock);
         
-        cycles_end = get_cycles();
-        master->idle_cycle_times[master->idle_cycle_time_pos]
-            = (u32) (cycles_end - cycles_start) * 1000 / cpu_khz;
-        master->idle_cycle_time_pos++;
-        master->idle_cycle_time_pos %= HZ;
-
 schedule:
         if (ec_fsm_master_idle(&master->fsm)) {
             set_current_state(TASK_INTERRUPTIBLE);
@@ -876,8 +856,6 @@
  */
 static int ec_master_operation_thread(ec_master_t *master)
 {
-    cycles_t cycles_start, cycles_end;
-
     daemonize("EtherCAT-OP");
     allow_signal(SIGTERM);
 
@@ -888,8 +866,6 @@
                 master->fsm_datagram.state == EC_DATAGRAM_QUEUED)
             goto schedule;
 
-        cycles_start = get_cycles();
-
         // output statistics
         ec_master_output_stats(master);
 
@@ -899,12 +875,6 @@
         // inject datagram
         master->injection_seq_fsm++;
 
-        cycles_end = get_cycles();
-        master->idle_cycle_times[master->idle_cycle_time_pos]
-            = (u32) (cycles_end - cycles_start) * 1000 / cpu_khz;
-        master->idle_cycle_time_pos++;
-        master->idle_cycle_time_pos %= HZ;
-
 schedule:
         if (ec_fsm_master_idle(&master->fsm)) {
             set_current_state(TASK_INTERRUPTIBLE);
@@ -972,7 +942,6 @@
     ec_master_t *master = (ec_master_t *) data;
     ec_eoe_t *eoe;
     unsigned int none_open = 1;
-    cycles_t cycles_start, cycles_end;
     unsigned long restart_jiffies;
 
     list_for_each_entry(eoe, &master->eoe_handlers, list) {
@@ -985,8 +954,9 @@
         goto queue_timer;
 
     // receive datagrams
-    if (master->request_cb(master->cb_data)) goto queue_timer;
-    cycles_start = get_cycles();
+    if (master->request_cb(master->cb_data))
+        goto queue_timer;
+    
     ecrt_master_receive(master);
     master->release_cb(master->cb_data);
 
@@ -1004,12 +974,6 @@
     }
     ecrt_master_send(master);
     master->release_cb(master->cb_data);
-    cycles_end = get_cycles();
-
-    master->eoe_cycle_times[master->eoe_cycle_time_pos]
-        = (u32) (cycles_end - cycles_start) * 1000 / cpu_khz;
-    master->eoe_cycle_time_pos++;
-    master->eoe_cycle_time_pos %= HZ;
 
  queue_timer:
     restart_jiffies = HZ / EC_EOE_FREQUENCY;
--- a/master/master.h	Thu Jun 19 10:18:58 2008 +0000
+++ b/master/master.h	Thu Jun 19 10:22:24 2008 +0000
@@ -135,15 +135,11 @@
 
     int thread_id; /**< Master thread PID. */
     struct completion thread_exit; /**< Thread completion object. */
-    uint32_t idle_cycle_times[HZ]; /**< Idle cycle times ring. */
-    unsigned int idle_cycle_time_pos; /**< time ring buffer position */
 
 #ifdef EC_EOE
     struct timer_list eoe_timer; /**< EoE timer object. */
     unsigned int eoe_running; /**< \a True, if EoE processing is active. */
     struct list_head eoe_handlers; /**< Ethernet-over-EtherCAT handlers. */
-    uint32_t eoe_cycle_times[HZ]; /**< EoE cycle times ring. */
-    unsigned int eoe_cycle_time_pos; /**< Time ring buffer position. */
 #endif
 
     spinlock_t internal_lock; /**< Spinlock used in \a IDLE phase. */