public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* systemtap/pcp integration
@ 2014-07-17 21:14 David Smith
  2014-07-18 15:49 ` Frank Ch. Eigler
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: David Smith @ 2014-07-17 21:14 UTC (permalink / raw)
  To: Systemtap List, pcp

[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]

Here's a small update on the prototype systemtap/pcp integration work
I'm doing. I've create a systemtap branch, called 'dsmith/mmv' that
contains all my work. Basically this work allows systemtap to create
'mmv' memory mapped files.

If you checkout and build that, then you should be able to run the
attached systemtap script. This script is a translation of pcp's example
python mmv script found in src/python/mmv.py.

Note that systemtap will create a file called 'mmv' in
/proc/systemtap/{MODULE_NAME}. I've just been using pcp's 'mmvdump'
utility to dump the contents of the /proc/systemtap/{MODULE_NAME}/mmv
file. Currently the pcp mmv pmda only looks in one place for mmv files,
but it might be possible to create a symbolic link to systemtap's mmv
file to make it happy.

The code works for the attached script, but I'm sure it is quite
fragile. Things like locking, error checking, documentation, etc. need
to be done.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

[-- Attachment #2: mmv.stp --]
[-- Type: text/plain, Size: 1286 bytes --]

global inst0, inst1, counter_metric, instant_metric, indom_metric
global instant_value

probe begin
{
	inst0 = mmv_add_instance(0, "zero")
	inst1 = mmv_add_instance(1, "hero")
	printf("instances: %d, %d\n", inst0, inst1)

	indom0 = mmv_add_indom(1, "We can be heroes",
			       "Set of instances from zero to hero")
 	mmv_add_indom_instance(indom0, inst0)
 	mmv_add_indom_instance(indom0, inst1)

	printf("indom: %d\n", indom0)

	counter_metric = mmv_add_metric("counter", 1, MMV_TYPE_NUMBER,
				 	MMV_SEM_COUNTER,
					mmv_units(0, 0, 1, 0, 0, 0),
					0, "Example counter metric",
					"Yep, a test counter metric")
	instant_metric = mmv_add_metric("instant", 2, MMV_TYPE_NUMBER,
					MMV_SEM_INSTANT,
					mmv_units(0, 0, 0, 0, 0, 0), 0,
					"Example instant metric",
					"Yep, a test instantaneous metric")
	indom_metric = mmv_add_metric("indom", 3, MMV_TYPE_NUMBER,
				      MMV_SEM_DISCRETE,
				      mmv_units(0, 0, 0, 0, 0, 0),
				      1, "", "")
	printf("metrics: %d, %d, %d\n", counter_metric, instant_metric,
	       indom_metric)

	mmv_stats_start(42, 0)

	instant_value = mmv_lookup_value(instant_metric, 0)
	mmv_set_value(instant_value, 41)
	mmv_inc_value(instant_value, 2)
}

probe timer.s(1)
{
	mmv_inc_value(instant_value, 3)
}

probe end
{
	mmv_stats_stop()
}

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-07-24  7:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-17 21:14 systemtap/pcp integration David Smith
2014-07-18 15:49 ` Frank Ch. Eigler
2014-07-18 17:02   ` David Smith
2014-07-18 18:27     ` Frank Ch. Eigler
2014-07-22 14:25       ` David Smith
2014-07-22 15:21         ` Frank Ch. Eigler
2014-07-22 21:02           ` David Smith
2014-07-18 21:10 ` [pcp] " William Cohen
2014-07-21 15:43   ` David Smith
2014-07-21 15:54     ` William Cohen
2014-07-22  1:32 ` Nathan Scott
2014-07-22  2:57   ` Frank Ch. Eigler
2014-07-22 14:50   ` [pcp] " David Smith
2014-07-23 10:29     ` Nathan Scott
2014-07-23 14:42       ` Frank Ch. Eigler
2014-07-24  7:40         ` Nathan Scott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).