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-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | #include <stdio.h> |
---|
21 | |
---|
22 | #include "shm_driver.h" |
---|
23 | |
---|
24 | void |
---|
25 | Shm_Print_statistics(void) |
---|
26 | { |
---|
27 | rtems_unsigned32 ticks; |
---|
28 | rtems_unsigned32 ticks_per_second; |
---|
29 | rtems_unsigned32 seconds; |
---|
30 | int packets_per_second; |
---|
31 | |
---|
32 | (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks ); |
---|
33 | (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second ); |
---|
34 | |
---|
35 | seconds = ticks / ticks_per_second; |
---|
36 | if ( seconds == 0 ) |
---|
37 | seconds = 1; |
---|
38 | |
---|
39 | packets_per_second = Shm_Receive_message_count / seconds; |
---|
40 | if ( (Shm_Receive_message_count % seconds) >= (seconds / 2) ) |
---|
41 | packets_per_second++; |
---|
42 | |
---|
43 | printf( "\n\nSHMDR STATISTICS (NODE %d)\n", Shm_Local_node ); |
---|
44 | printf( "TICKS SINCE BOOT = %d\n", ticks ); |
---|
45 | printf( "TICKS PER SECOND = %d\n", ticks_per_second ); |
---|
46 | printf( "ISRs=%d\n", Shm_Interrupt_count ); |
---|
47 | printf( "RECV=%d\n", Shm_Receive_message_count ); |
---|
48 | printf( "NULL=%d\n", Shm_Null_message_count ); |
---|
49 | printf( "PKTS/SEC=%d\n", packets_per_second ); |
---|
50 | } |
---|