New statistic outputs to avoid blasting the logs.
This commit is contained in:
parent
4e9ef991e3
commit
eed6f1d855
|
|
@ -106,6 +106,8 @@ int ec_domain_init(ec_domain_t *domain, /**< EtherCAT domain */
|
|||
domain->data_size = 0;
|
||||
domain->base_address = 0;
|
||||
domain->response_count = 0xFFFFFFFF;
|
||||
domain->t_last = 0;
|
||||
domain->working_counter_changes = 0;
|
||||
|
||||
INIT_LIST_HEAD(&domain->data_regs);
|
||||
INIT_LIST_HEAD(&domain->datagrams);
|
||||
|
|
@ -511,6 +513,7 @@ void ecrt_domain_process(ec_domain_t *domain /**< EtherCAT domain */)
|
|||
{
|
||||
unsigned int working_counter_sum;
|
||||
ec_datagram_t *datagram;
|
||||
cycles_t t_now = get_cycles();
|
||||
|
||||
working_counter_sum = 0;
|
||||
list_for_each_entry(datagram, &domain->datagrams, list) {
|
||||
|
|
@ -520,9 +523,23 @@ void ecrt_domain_process(ec_domain_t *domain /**< EtherCAT domain */)
|
|||
}
|
||||
|
||||
if (working_counter_sum != domain->response_count) {
|
||||
domain->working_counter_changes++;
|
||||
domain->response_count = working_counter_sum;
|
||||
EC_INFO("Domain %i working counter change: %i\n", domain->index,
|
||||
domain->response_count);
|
||||
}
|
||||
|
||||
if (domain->working_counter_changes &&
|
||||
(u32) (t_now - domain->t_last) / cpu_khz > 1000) {
|
||||
domain->t_last = t_now;
|
||||
if (domain->working_counter_changes == 1) {
|
||||
EC_INFO("Domain %i working counter change: %i\n", domain->index,
|
||||
domain->response_count);
|
||||
}
|
||||
else {
|
||||
EC_INFO("Domain %i: %u WC changes. Current response count: %i\n",
|
||||
domain->index, domain->working_counter_changes,
|
||||
domain->response_count);
|
||||
}
|
||||
domain->working_counter_changes = 0;
|
||||
}
|
||||
|
||||
ec_domain_queue(domain);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ struct ec_domain
|
|||
uint32_t base_address; /**< logical offset address of the process data */
|
||||
unsigned int response_count; /**< number of responding slaves */
|
||||
struct list_head data_regs; /**< PDO data registrations */
|
||||
unsigned int working_counter_changes; /**< working counter changes
|
||||
since last notification */
|
||||
cycles_t t_last; /**< time of last notification */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ void ec_master_reset(ec_master_t *master /**< EtherCAT master */)
|
|||
master->stats.timeouts = 0;
|
||||
master->stats.delayed = 0;
|
||||
master->stats.corrupted = 0;
|
||||
master->stats.skipped = 0;
|
||||
master->stats.unmatched = 0;
|
||||
master->stats.t_last = 0;
|
||||
|
||||
|
|
@ -287,9 +288,9 @@ void ec_master_queue_datagram(ec_master_t *master, /**< EtherCAT master */
|
|||
// check, if the datagram is already queued
|
||||
list_for_each_entry(queued_datagram, &master->datagram_queue, queue) {
|
||||
if (queued_datagram == datagram) {
|
||||
master->stats.skipped++;
|
||||
ec_master_output_stats(master);
|
||||
datagram->state = EC_DATAGRAM_QUEUED;
|
||||
if (unlikely(master->debug_level))
|
||||
EC_WARN("datagram already queued.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -538,6 +539,10 @@ void ec_master_output_stats(ec_master_t *master /**< EtherCAT master */)
|
|||
EC_WARN("%i frame(s) CORRUPTED!\n", master->stats.corrupted);
|
||||
master->stats.corrupted = 0;
|
||||
}
|
||||
if (master->stats.skipped) {
|
||||
EC_WARN("%i datagram(s) SKIPPED!\n", master->stats.skipped);
|
||||
master->stats.skipped = 0;
|
||||
}
|
||||
if (master->stats.unmatched) {
|
||||
EC_WARN("%i datagram(s) UNMATCHED!\n", master->stats.unmatched);
|
||||
master->stats.unmatched = 0;
|
||||
|
|
@ -1234,7 +1239,7 @@ void ecrt_master_receive(ec_master_t *master /**< EtherCAT master */)
|
|||
ec_device_call_isr(master->device);
|
||||
|
||||
t_received = get_cycles();
|
||||
t_timeout = (cycles_t) EC_IO_TIMEOUT * (cpu_khz / 1000);
|
||||
t_timeout = EC_IO_TIMEOUT * cpu_khz / 1000;
|
||||
|
||||
// dequeue all received datagrams
|
||||
list_for_each_entry_safe(datagram, next, &master->datagram_queue, queue)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,10 @@ typedef struct
|
|||
unsigned int timeouts; /**< datagram timeouts */
|
||||
unsigned int delayed; /**< delayed datagrams */
|
||||
unsigned int corrupted; /**< corrupted frames */
|
||||
unsigned int unmatched; /**< unmatched datagrams */
|
||||
unsigned int skipped; /**< skipped datagrams (the ones that were
|
||||
requeued when not yet received) */
|
||||
unsigned int unmatched; /**< unmatched datagrams (received, but not
|
||||
queued any longer) */
|
||||
cycles_t t_last; /**< time of last output */
|
||||
}
|
||||
ec_stats_t;
|
||||
|
|
|
|||
Loading…
Reference in New Issue