#include <rpc_stats.hh>
Collaboration diagram for RPCStats:

Public Member Functions | |
| RPCStats (int id) | |
| void | printStats (FILE *output) |
Private Member Functions | |
| void | readCounters () |
| void | openFiles () |
| void | closeFiles () |
Private Attributes | |
| int | node_id |
| int | rpc_tx_bytes |
| int | rpc_rx_bytes |
| int | rpc_tx_frames |
| int | rpc_rx_frames |
| FILE * | tx_bytes |
| FILE * | rx_bytes |
| FILE * | tx_frames |
| FILE * | rx_frames |
|
|
Definition at line 12 of file rpc_stats.cc. References closeFiles(), node_id, openFiles(), rpc_rx_bytes, rpc_rx_frames, rpc_tx_bytes, rpc_tx_frames, rx_bytes, rx_frames, tx_bytes, and tx_frames.
00012 {
00013 // Zero counters
00014 rpc_tx_bytes = 0;
00015 rpc_rx_bytes = 0;
00016 rpc_tx_frames = 0;
00017 rpc_rx_frames = 0;
00018
00019 #ifndef __MOTE_NIC__
00020 // Initialize Radiometrix counters
00021 openFiles();
00022
00023 fprintf(tx_bytes, "%d", rpc_tx_bytes);
00024 fprintf(rx_bytes, "%d", rpc_rx_bytes);
00025 fprintf(tx_frames, "%d", rpc_tx_frames);
00026 fprintf(rx_frames, "%d", rpc_rx_frames);
00027
00028 closeFiles();
00029 #endif
00030
00031 node_id = id;
00032 }
|
Here is the call graph for this function:

|
|
Definition at line 61 of file rpc_stats.cc. References rx_bytes, rx_frames, tx_bytes, and tx_frames. Referenced by readCounters(), and RPCStats().
00062 {
00063 fclose(tx_bytes);
00064 fclose(rx_bytes);
00065 fclose(tx_frames);
00066 fclose(rx_frames);
00067 }
|
|
|
Definition at line 48 of file rpc_stats.cc. References rx_bytes, rx_frames, tx_bytes, and tx_frames. Referenced by readCounters(), and RPCStats().
00049 {
00050 tx_bytes = fopen("/proc/krpc/tx_bytes", "w");
00051 rx_bytes = fopen("/proc/krpc/rx_bytes", "w");
00052 tx_frames = fopen("/proc/krpc/tx_frames", "w");
00053 rx_frames = fopen("/proc/krpc/rx_frames", "w");
00054
00055 if (!tx_bytes || !rx_bytes || !tx_frames || !rx_frames){
00056 printf("Error: Can't talk to RPC driver !\n");
00057 exit(-1);
00058 }
00059 }
|
|
|
Definition at line 69 of file rpc_stats.cc. References node_id, rpc_rx_bytes, rpc_rx_frames, rpc_tx_bytes, and rpc_tx_frames.
00070 {
00071 #ifndef __MOTE_NIC__
00072 fprintf(output, "Radiometrix Stats\n");
00073 fprintf(output, "-----------------\n\n");
00074 fprintf(output, "Node id : %d\n\n", node_id);
00075
00076 fprintf(output, "RPC : Bytes sent : %d - Bytes received : %d\n",
00077 rpc_tx_bytes, rpc_rx_bytes);
00078 fprintf(output, "RPC : Frames sent : %d - Frames received : %d\n",
00079 rpc_tx_frames, rpc_rx_frames);
00080 fprintf(output, "\n");
00081 #else
00082 /*
00083 fprintf(output, "Mote-Nic Stats\n");
00084 fprintf(output, "-----------------\n\n");
00085 fprintf(output, "Node id : %d\n\n", node_id);
00086
00087 fprintf(output, "Mote-Nic : Bytes sent : %d - Bytes received : %d\n",
00088 rpc_tx_bytes, rpc_rx_bytes);
00089 fprintf(output, "Mote-Nic : Frames sent : %d - Frames received : %d\n",
00090 rpc_tx_frames, rpc_rx_frames);
00091 fprintf(output, "\n");
00092 */
00093 #endif
00094 }
|
|
|
Definition at line 34 of file rpc_stats.cc. References closeFiles(), openFiles(), rpc_rx_bytes, rpc_rx_frames, rpc_tx_bytes, rpc_tx_frames, rx_bytes, rx_frames, tx_bytes, and tx_frames.
00035 {
00036 #ifndef __MOTE_NIC__
00037 openFiles();
00038
00039 fscanf(tx_bytes, "%d", &rpc_tx_bytes);
00040 fscanf(rx_bytes, "%d", &rpc_rx_bytes);
00041 fscanf(tx_frames, "%d", &rpc_tx_frames);
00042 fscanf(rx_frames, "%d", &rpc_rx_frames);
00043
00044 closeFiles();
00045 #endif
00046 }
|
Here is the call graph for this function:

|
|
Definition at line 26 of file rpc_stats.hh. Referenced by printStats(), and RPCStats(). |
|
|
Definition at line 30 of file rpc_stats.hh. Referenced by printStats(), readCounters(), and RPCStats(). |
|
|
Definition at line 32 of file rpc_stats.hh. Referenced by printStats(), readCounters(), and RPCStats(). |
|
|
Definition at line 29 of file rpc_stats.hh. Referenced by printStats(), readCounters(), and RPCStats(). |
|
|
Definition at line 31 of file rpc_stats.hh. Referenced by printStats(), readCounters(), and RPCStats(). |
|
|
Definition at line 36 of file rpc_stats.hh. Referenced by closeFiles(), openFiles(), readCounters(), and RPCStats(). |
|
|
Definition at line 38 of file rpc_stats.hh. Referenced by closeFiles(), openFiles(), readCounters(), and RPCStats(). |
|
|
Definition at line 35 of file rpc_stats.hh. Referenced by closeFiles(), openFiles(), readCounters(), and RPCStats(). |
|
|
Definition at line 37 of file rpc_stats.hh. Referenced by closeFiles(), openFiles(), readCounters(), and RPCStats(). |
1.3.3