[ac7d5ef0] | 1 | /* |
---|
| 2 | * This routine is invoked following a reset to report the statistics |
---|
| 3 | * gathered during the previous execution. |
---|
| 4 | * |
---|
| 5 | * Input parameters: NONE |
---|
| 6 | * |
---|
| 7 | * Output parameters: NONE |
---|
| 8 | * |
---|
[a29bf16b] | 9 | * COPYRIGHT (c) 1989-2007. |
---|
[ac7d5ef0] | 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
[98e4ebf5] | 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
[4e89a12] | 14 | * http://www.rtems.com/license/LICENSE. |
---|
[ac7d5ef0] | 15 | * |
---|
| 16 | * $Id$ |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #include <rtems.h> |
---|
| 20 | #include <stdio.h> |
---|
[a29bf16b] | 21 | #include <inttypes.h> |
---|
| 22 | #include <rtems/bspIo.h> |
---|
[ac7d5ef0] | 23 | |
---|
[48bfd992] | 24 | #include "shm_driver.h" |
---|
[ac7d5ef0] | 25 | |
---|
| 26 | void |
---|
| 27 | Shm_Print_statistics(void) |
---|
| 28 | { |
---|
[ee4f57d] | 29 | uint32_t ticks; |
---|
| 30 | uint32_t ticks_per_second; |
---|
| 31 | uint32_t seconds; |
---|
[a29bf16b] | 32 | int packets_per_second; |
---|
[ac7d5ef0] | 33 | |
---|
[534c893] | 34 | ticks = rtems_clock_get_ticks_since_boot(); |
---|
| 35 | ticks_per_second = rtems_clock_get_ticks_per_second(); |
---|
[ac7d5ef0] | 36 | |
---|
| 37 | seconds = ticks / ticks_per_second; |
---|
[64b976a] | 38 | if ( seconds == 0 ) |
---|
| 39 | seconds = 1; |
---|
[ac7d5ef0] | 40 | |
---|
| 41 | packets_per_second = Shm_Receive_message_count / seconds; |
---|
| 42 | if ( (Shm_Receive_message_count % seconds) >= (seconds / 2) ) |
---|
| 43 | packets_per_second++; |
---|
| 44 | |
---|
[534c893] | 45 | printk( "\n\nSHMDR STATISTICS (NODE %" PRId32 ")\n", |
---|
| 46 | Multiprocessing_configuration.node ); |
---|
[a29bf16b] | 47 | printk( "TICKS SINCE BOOT = %" PRId32 "\n", ticks ); |
---|
| 48 | printk( "TICKS PER SECOND = %" PRId32 "\n", ticks_per_second ); |
---|
| 49 | printk( "ISRs=%" PRId32 "\n", Shm_Interrupt_count ); |
---|
| 50 | printk( "RECV=%" PRId32 "\n", Shm_Receive_message_count ); |
---|
| 51 | printk( "NULL=%" PRId32 "\n", Shm_Null_message_count ); |
---|
| 52 | printk( "PKTS/SEC=%" PRId32 "\n", packets_per_second ); |
---|
[ac7d5ef0] | 53 | } |
---|