# HG changeset patch # User Florian Pose # Date 1154635880 0 # Node ID e16093374dfda6f67abbc7080bd9c38c117207c3 # Parent 17f58fe99511d0d633c40f2a4b8b617d13a280a9 New statistic outputs to avoid blasting the logs. diff -r 17f58fe99511 -r e16093374dfd master/domain.c --- a/master/domain.c Thu Aug 03 19:47:29 2006 +0000 +++ b/master/domain.c Thu Aug 03 20:11:20 2006 +0000 @@ -106,6 +106,8 @@ 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 @@ { 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 @@ } 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); diff -r 17f58fe99511 -r e16093374dfd master/domain.h --- a/master/domain.h Thu Aug 03 19:47:29 2006 +0000 +++ b/master/domain.h Thu Aug 03 20:11:20 2006 +0000 @@ -67,6 +67,9 @@ 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 */ }; /*****************************************************************************/ diff -r 17f58fe99511 -r e16093374dfd master/master.c --- a/master/master.c Thu Aug 03 19:47:29 2006 +0000 +++ b/master/master.c Thu Aug 03 20:11:20 2006 +0000 @@ -240,6 +240,7 @@ 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 @@ // 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 @@ 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 @@ 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) diff -r 17f58fe99511 -r e16093374dfd master/master.h --- a/master/master.h Thu Aug 03 19:47:29 2006 +0000 +++ b/master/master.h Thu Aug 03 20:11:20 2006 +0000 @@ -74,7 +74,10 @@ 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;