[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 | * |
---|
| 9 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * All rights assigned to U.S. Government, 1994. |
---|
| 12 | * |
---|
| 13 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 14 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 15 | * notice must appear in all copies of this file and its derivatives. |
---|
| 16 | * |
---|
| 17 | * $Id$ |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | #include <rtems.h> |
---|
| 21 | #include <stdio.h> |
---|
| 22 | |
---|
| 23 | #include "shm.h" |
---|
| 24 | |
---|
| 25 | void |
---|
| 26 | Shm_Print_statistics(void) |
---|
| 27 | { |
---|
| 28 | rtems_unsigned32 ticks; |
---|
| 29 | rtems_unsigned32 ticks_per_second; |
---|
| 30 | rtems_unsigned32 seconds; |
---|
| 31 | int packets_per_second; |
---|
| 32 | |
---|
| 33 | (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks ); |
---|
| 34 | (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second ); |
---|
| 35 | |
---|
| 36 | seconds = ticks / ticks_per_second; |
---|
[64b976a] | 37 | if ( seconds == 0 ) |
---|
| 38 | seconds = 1; |
---|
[ac7d5ef0] | 39 | |
---|
| 40 | packets_per_second = Shm_Receive_message_count / seconds; |
---|
| 41 | if ( (Shm_Receive_message_count % seconds) >= (seconds / 2) ) |
---|
| 42 | packets_per_second++; |
---|
| 43 | |
---|
| 44 | printf( "\n\nSHMDR STATISTICS (NODE %d)\n", Shm_Local_node ); |
---|
| 45 | printf( "TICKS SINCE BOOT = %d\n", ticks ); |
---|
| 46 | printf( "TICKS PER SECOND = %d\n", ticks_per_second ); |
---|
| 47 | printf( "ISRs=%d\n", Shm_Interrupt_count ); |
---|
| 48 | printf( "RECV=%d\n", Shm_Receive_message_count ); |
---|
| 49 | printf( "NULL=%d\n", Shm_Null_message_count ); |
---|
| 50 | printf( "PKTS/SEC=%d\n", packets_per_second ); |
---|
| 51 | } |
---|