SmartSockets Monitoring
Überwachung des Informationsflusses
Neben den Kommunikationsbeziehungen
innerhalb einer verteilten Anwendung ist auch der Informationsfluß
überwachbar. Er gibt wichtige Aussagen über eine Bandbreitennutzung und
Richtung des Nachrichtenverkehrs.
Verwendet wird hier aus dem TipcMon* API die Funktion
TipcMonClientMsgTrafficPoll(T_IPC_MON_ALL);
In einer wie folgt geeigneten Empfangsroutine werden die so generierten
Informationen verarbeitet und können (hier in der Konsole) ausgegeben werden.
/* ===================================================== */
/* ProcessTrafficPoll - callback to access and output*/
/* a MON_CLIENT_MSG_TRAFFIC_POLL_RESULT message */
6 static void T_ENTRY ProcessTrafficPoll
(
T_IPC_CONN conn,
T_IPC_CONN_PROCESS_CB_DATA data,
T_CB_ARG arg
)
{
7 T_IPC_MSG msg = data->msg;
8 T_STR client_name;
9 T_INT4 total_msg_recv;
10 T_INT4 total_msg_send;
11 T_INT4 total_byte_recv;
12 T_INT4 total_byte_send;
/* Set current field */
13 TipcMsgSetCurrent(msg, 0);
/* Get the fields from the message */
14 TipcMsgRead(data->msg, T_IPC_FT_STR, &client_name,
T_IPC_FT_INT4, &total_msg_recv,
T_IPC_FT_INT4, &total_msg_send,
T_IPC_FT_INT4, &total_byte_recv,
T_IPC_FT_INT4, &total_byte_send,
NULL);
/* Print out the new information received */
15 TutOut("Summary of message traffic for client <%s>\n",
client_name);
16 TutOut(" Total messages received = %d\n", total_msg_recv);
17 TutOut(" Total messages sent = %d\n", total_msg_send);
18 TutOut(" Total bytes received = %d\n", total_byte_recv);
19 TutOut(" Total bytes sent = %d\n", total_byte_send);
20 TutOut("==============================================\n");
} /* ProcessTrafficPoll */
/* ===================================================== */
Resultat eines solchen abgesetzten Funktionsaufrufes ist dann ein genaues
Bild der Menge an Nachrichten innerhalb eines Kanals.
==> Polling all client for message traffic info
Summary of message traffic for client
Total messages received = 47
Total messages sent = 5
Total bytes received = 5784
Total bytes sent = 5784
======================================================
Summary of message traffic for client
Total messages received = 2
Total messages sent = 2
Total bytes received = 376
Total bytes sent = 376
======================================================
Summary of message traffic for client
Total messages received = 12
Total messages sent = 2
Total bytes received = 1536
Total bytes sent = 1536
======================================================
|