Re-add DTrace probes on 'dispose' functions

When converting to virObject, the probes on the 'Free' functions
were removed on the basis that there is a probe on virObjectFree
that suffices. This puts a burden on people writing probe scripts
to identify which object is being dispose. This adds back probes
in the 'Dispose' functions and updates the rpc monitor systemtap
example to use them

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-03-13 19:17:32 +00:00
parent 1732c1c629
commit ad9ea4a9fd
7 changed files with 37 additions and 24 deletions

View File

@ -117,11 +117,9 @@ probe libvirt.rpc.socket_new {
remoteAddrs[pid(), sock] = remoteAddr;
}
probe libvirt.rpc.socket_free {
if (refs == 1) {
delete localAddrs[pid(), sock];
delete remoteAddrs[pid(), sock];
}
probe libvirt.rpc.socket_dispose {
delete localAddrs[pid(), sock];
delete remoteAddrs[pid(), sock];
}
@ -131,13 +129,11 @@ probe libvirt.rpc.client_new {
print_ts(sprintf("C + %-16p local=%s remote=%s", client, localAddrs[pid(), sock], remoteAddrs[pid(), sock]));
}
probe libvirt.rpc.client_free {
if (refs == 1) {
print_ts(sprintf("C - %-16p local=%s remote=%s", client,
localAddrs[pid(), clientSocks[pid(), client]],
remoteAddrs[pid(), clientSocks[pid(), client]]));
delete clientSocks[pid(), client];
}
probe libvirt.rpc.client_dispose {
print_ts(sprintf("C - %-16p local=%s remote=%s", client,
localAddrs[pid(), clientSocks[pid(), client]],
remoteAddrs[pid(), clientSocks[pid(), client]]));
delete clientSocks[pid(), client];
}
@ -147,13 +143,11 @@ probe libvirt.rpc.server_client_new {
print_ts(sprintf("+ S %-16p local=%s remote=%s", client, localAddrs[pid(), sock], remoteAddrs[pid(), sock]));
}
probe libvirt.rpc.server_client_free {
if (refs == 1) {
print_ts(sprintf("- S %-16p local=%s remote=%s", client,
localAddrs[pid(), serverSocks[pid(), client]],
remoteAddrs[pid(), serverSocks[pid(), client]]));
delete serverSocks[pid(), client];
}
probe libvirt.rpc.server_client_dispose {
print_ts(sprintf("- S %-16p local=%s remote=%s", client,
localAddrs[pid(), serverSocks[pid(), client]],
remoteAddrs[pid(), serverSocks[pid(), client]]));
delete serverSocks[pid(), client];
}

View File

@ -26,6 +26,7 @@ provider libvirt {
# file: src/rpc/virnetsocket.c
# prefix: rpc
probe rpc_socket_new(void *sock, int fd, int errfd, pid_t pid, const char *localAddr, const char *remoteAddr);
probe rpc_socket_dispose(void *sock);
probe rpc_socket_send_fd(void *sock, int fd);
probe rpc_socket_recv_fd(void *sock, int fd);
@ -33,7 +34,7 @@ provider libvirt {
# file: src/rpc/virnetserverclient.c
# prefix: rpc
probe rpc_server_client_new(void *client, void *sock);
probe rpc_server_client_dispose(void *client);
probe rpc_server_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
probe rpc_server_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
@ -41,7 +42,7 @@ provider libvirt {
# file: src/rpc/virnetclient.c
# prefix: rpc
probe rpc_client_new(void *client, void *sock);
probe rpc_client_dispose(void *client);
probe rpc_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
probe rpc_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial);
@ -57,14 +58,14 @@ provider libvirt {
# prefix: rpc
probe rpc_tls_context_new(void *ctxt, const char *cacert, const char *cacrl,
const char *cert, const char *key, int sanityCheckCert, int requireValidCert, int isServer);
probe rpc_tls_context_dispose(void *ctxt);
probe rpc_tls_context_session_allow(void *ctxt, void *sess, const char *dname);
probe rpc_tls_context_session_deny(void *ctxt, void *sess, const char *dname);
probe rpc_tls_context_session_fail(void *ctxt, void *sess);
probe rpc_tls_session_new(void *sess, void *ctxt, const char *hostname, int isServer);
probe rpc_tls_session_dispose(void *sess);
probe rpc_tls_session_handshake_pass(void *sess);
probe rpc_tls_session_handshake_fail(void *sess);
@ -72,6 +73,7 @@ provider libvirt {
# file: src/rpc/virkeepalive.c
# prefix: rpc
probe rpc_keepalive_new(void *ka, void *client);
probe rpc_keepalive_dispose(void *ka);
probe rpc_keepalive_start(void *ka, void *client, int interval, int count);
probe rpc_keepalive_stop(void *ka, void *client);
probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc);

View File

@ -224,6 +224,9 @@ virKeepAliveDispose(void *obj)
{
virKeepAlivePtr ka = obj;
PROBE(RPC_KEEPALIVE_DISPOSE,
"ka=%p", ka);
ka->freeCB(ka->client);
}

View File

@ -596,6 +596,9 @@ void virNetClientDispose(void *obj)
virNetClientPtr client = obj;
int i;
PROBE(RPC_CLIENT_DISPOSE,
"client=%p", client);
if (client->closeFf)
client->closeFf(client->closeOpaque);

View File

@ -704,6 +704,9 @@ void virNetServerClientDispose(void *obj)
{
virNetServerClientPtr client = obj;
PROBE(RPC_SERVER_CLIENT_DISPOSE,
"client=%p", client);
if (client->privateData &&
client->privateDataFreeFunc)
client->privateDataFreeFunc(client->privateData);

View File

@ -996,7 +996,9 @@ void virNetSocketDispose(void *obj)
{
virNetSocketPtr sock = obj;
VIR_DEBUG("sock=%p fd=%d", sock, sock->fd);
PROBE(RPC_SOCKET_DISPOSE,
"sock=%p", sock);
if (sock->watch > 0) {
virEventRemoveHandle(sock->watch);
sock->watch = -1;

View File

@ -1114,6 +1114,9 @@ void virNetTLSContextDispose(void *obj)
{
virNetTLSContextPtr ctxt = obj;
PROBE(RPC_TLS_CONTEXT_DISPOSE,
"ctxt=%p", ctxt);
gnutls_dh_params_deinit(ctxt->dhParams);
gnutls_certificate_free_credentials(ctxt->x509cred);
}
@ -1366,6 +1369,9 @@ void virNetTLSSessionDispose(void *obj)
{
virNetTLSSessionPtr sess = obj;
PROBE(RPC_TLS_SESSION_DISPOSE,
"sess=%p", sess);
VIR_FREE(sess->hostname);
gnutls_deinit(sess->session);
}