pcp
[Top] [All Lists]

Add dtrace support to pmcd

To: PCP <pcp@xxxxxxxxxxx>
Subject: Add dtrace support to pmcd
From: Stan Cox <scox@xxxxxxxxxx>
Date: Mon, 19 Aug 2013 14:51:35 -0400
Delivered-to: pcp@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4
This patch adds infrastructure for dtrace style static probes. These are low overhead probes that can be used by, for example, systemtap to provide runtime tracing information. A systemtap script which provides functionality similar to the current pcp tracing facility is included below (pcpprobes.stp).

The patch consists of three parts: configuration support to enable pcp to be built with dtrace/systemtap, changes to the tracing call sequence to integrate it with dtrace style probing, and runtime support for probing.

The configuration changes follow the pattern used by other packages, which consists of adding the --enable-dtrace configuration option which results in invoking dtrace to build the probes header and object file. The nature of these generated files depends on whether dtrace or systemtap are being used.

The call sequence changes consist of adding a pmcd_trace_mask argument and having pmcd_trace determine if tracing is enabled or not. The static probe points are also setup in pmcd_trace.

The runtime changes consist of setting up the probe point in pmcd_trace. There is one probe point per trace call type, e.g. TR_XMIT_PDU. Most probes use the standard trace arguments of who, p1, p2. An exception is TR_XMIT_PDU, which adds p3, p4 to enable passing additional instance information. The systemtap side is in pcpprobes.stp which provide systemtap functionality somewhat akin to pmcd_dump_trace. (Of course the /usr/local/... path will not be hardcoded there.)


Example output:
New client: [0]
Xmit: ERROR PDU, fd=1027,  err=0
Recv: ERROR PDU, fd=1027, pdubuf=0x0
Recv: ERROR PDU, fd=1027, pdubuf=0x0
Recv: ERROR PDU, fd=1027, pdubuf=0x0
Xmit: PMNS_NAMES PDU, fd=1027,
Recv: PMNS_NAMES PDU, fd=1027, pdubuf=0x28
Xmit: PMNS_IDS PDU, fd=1027,
Recv: PMNS_IDS PDU, fd=1027, pdubuf=0x14
Recv: PMNS_IDS PDU, fd=1027, pdubuf=0x14
Xmit: RESULT PDU, fd=1027, numpmid=20
Recv: RESULT PDU, fd=1027, pdubuf=0x14
Xmit: DESC PDU, fd=1027, pmid=60.0.60
Recv: DESC PDU, fd=1027, pdubuf=0x3c
Xmit: INSTANCE PDU, fd=1027, indom=60.60
Recv: INSTANCE PDU, fd=1027, pdubuf=0x3c
Xmit: DESC PDU, fd=1027, pmid=60.0.60
Recv: DESC PDU, fd=1027, pdubuf=0x3c


Attachment: pcpsdt.diff
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>