TipcSrvMonClientInfoPoll poll for RTclient information
srv
connection handle to RTserver
client_name
name of RTclient to poll (wildcard names allowed, or use T_IPC_MON_ALL to indicate a poll of all RTclients matching the value of Monitor_Scope)
TRUE
if the poll was successfully initiated, FALSE
otherwise.
If TipcSrvMonClientInfoPoll fails, it returns FALSE
and sets the global SmartSockets error number to:
TipcSrvMonClientInfoPoll polls for RTclient information by sending a MON_CLIENT_INFO_POLL_CALL message to the RTserver. The client_name
argument can be the unique subject name of a single RTclient, a wildcarded subject name to match many RTclients, or T_IPC_MON_ALL to poll all RTclients in the project that match the value of the Monitor_Scope option. The srv
argument indicates the connection on which the poll is to be sent.
The RTserver responds by sending back a MON_CLIENT_INFO_POLL_RESULT message. The response may or may not come back quickly, depending on what the polled RTclient is doing. Each MON_CLIENT_INFO_POLL_RESULT message contains 15 fields:
Development_RTmon
)sun4_solaris
)sbrk
value (the edge of the RTclient's virtual memory address space)sbrk
value (the edge of the process's virtual memory address space) since the RTclient started (actually, since the process's first call to any SmartSockets function)
There are multiple responses only if client_name
is a wildcard or T_IPC_MON_ALL.
If the RTclient cannot query the operating system, the value reported in the CPU percentage used field is a negative number.
There is no response message if the RTclient named client_name
does not exist; the poll is silently dropped.
TipcSrvMonClientInfoPoll sends a MON_CLIENT_INFO_POLL_CALL message to RTserver, but does not explicitly flush the message. See TipcSrvConnGetAutoFlushSize for more information on message buffering.
RTclient information can only be polled, not watched.
This example uses TipcSrvMonClientInfoPoll to
10
seconds for the poll results/* =============================================================== */
/*..process_mon_client_info_poll_result - process a
MON_CLIENT_INFO_POLL_RESULT message */
void process_mon_client_info_poll_result(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_PROCESS_CB_DATA data; T_CB_ARG arg; { T_STR client_name; T_STR ident; T_STR node_name; T_STR user_name; T_INT4 pid; T_STR project; T_STR server_name; T_STR arch; T_INT4 current_sbrk; T_INT4 delta_sbrk; T_INT2 int_format; T_INT2 real_format; T_STR logical_conn_name; T_INT4 num_subject_subscribe; T_REAL4 cpu_utilization;/* must set current field first */
if (!TipcMsgSetCurrent(data->msg, 0)) {return
; /* error */
}/* get the fields from the message */
if (!TipcMsgRead(data->msg, T_IPC_FT_STR, &client_name, T_IPC_FT_STR, &ident, T_IPC_FT_STR, &node_name, T_IPC_FT_STR, &user_name, T_IPC_FT_INT4, &pid, T_IPC_FT_STR, &project, T_IPC_FT_STR, &server_name, T_IPC_FT_STR, &arch, T_IPC_FT_INT4, ¤t_sbrk, T_IPC_FT_INT4, &delta_sbrk, T_IPC_FT_INT2, &int_format, T_IPC_FT_INT2, &real_format, T_IPC_FT_STR, &logical_conn_name, T_IPC_FT_INT4, &num_subject_subscribe, T_IPC_FT_REAL4, &cpu_utilization, NULL)) {return
; /* error */
} TutOut("Got CLIENT_INFO poll result.\n"); TutOut("RTclient name = %s\n", client_name); TutOut("ident = %s\n", ident); TutOut("node name = %s\n", node_name); TutOut("user name = %s\n", user_name); TutOut("pid = %d\n", pid); TutOut("project = %s\n", project); TutOut("RTserver name = %s\n", server_name); TutOut("architecture = %s\n", arch); TutOut("current sbrk value = %d\n", current_sbrk); TutOut("delta sbrk value = %d\n", delta_sbrk); TutOut("int format = %d\n", int_format); TutOut("real format = %d\n", real_format); TutOut("logical conn name = %s\n", logical_conn_name); TutOut("number of subject subscribes = %d\n", num_subject_subscribe); TutOut("CPU utilization percentage = %f\n", cpu_utilization); }/* process_mon_client_info_poll_result */
/* =============================================================== */
/*...code from calling function is below */
T_IPC_MT mt;/* send the poll request out to RTserver */
if (!TipcSrvMonClientInfoPoll(srv, "/...")) {return
; /* error */
} mt = TipcMtLookupByNum(T_MT_MON_CLIENT_INFO_POLL_RESULT); if (mt == NULL) {return
; /* error */
} if (TipcSrvConnProcessCbCreate(srv, mt, process_mon_client_info_poll_result, NULL) == NULL) {return
; /* error */
}/* read and process all poll results (as well as any other incoming messages) that arrive within the next 10 seconds */
if (!TipcSrvConnMainLoop(srv, 10.0)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |