lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Apr 2015 15:09:27 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	David Ahern <dsahern@...il.com>
Cc:	Steven Rostedt <rostedt@...dmis.org>,
	Namhyung Kim <namhyung@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: perf/tracepoints access to interpreted strings

Em Wed, Apr 15, 2015 at 10:20:08AM -0600, David Ahern escreveu:
> I was hoping you could provide points on how to get access to an interpreted
> field in a tracepoint within perf.
 
> This is an example of the tracepoint:
 
> # cat /sys/kernel/debug/tracing/events/irq/softirq_exit/format
> name: softirq_exit
> ID: 99
> format:
> 	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
> 	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
> 	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
> 	field:int common_pid;	offset:4;	size:4;	signed:1;
> 	field:int common_padding;	offset:8;	size:4;	signed:1;
> 
> 	field:unsigned int vec;	offset:12;	size:4;	signed:0;
> 
> print fmt: "vec=%u [action=%s]", REC->vec, __print_symbolic(REC->vec, {
> HI_SOFTIRQ, "HI" }, { TIMER_SOFTIRQ, "TIMER" }, { NET_TX_SOFTIRQ, "NET_TX"
> }, { NET_RX_SOFTIRQ, "NET_RX" }, { BLOCK_SOFTIRQ, "BLOCK" }, {
> BLOCK_IOPOLL_SOFTIRQ, "BLOCK_IOPOLL" }, { TASKLET_SOFTIRQ, "TASKLET" }, {
> SCHED_SOFTIRQ, "SCHED" }, { HRTIMER_SOFTIRQ, "HRTIMER" }, { RCU_SOFTIRQ,
> "RCU" })
 
> I would like to programmatically extract the action string. 'perf script'
> prints the samples fine which suggests libtraceevent extracts the
> information somehow.
 
> Can you provide a suggestion -- something along the lines of
> perf_evsel__intval() or perf_evsel__rawptr()?

We'll gonna have to parse the "print fmt" thing and look for entries
surrounded by [], then match it with the list of parameters, so that we
can end up with a:

	const char *perf_evsel__enum_entry(struct perf_evsel *evsel,
					   struct perf_sample *sample,
					   const char *enum_name,
					   int value);

That would return one of "TIMER", "NET_TX", etc, that is, 0,
1, N.

If it is strictly an enum, i.e. no holes and just by looking at the
"format" file above I don't see how it could have holes, albeit enums
may have, we can as well have this:

	const char *perf_evsel__enum(struct perf_evsel *evsel,
				     struct perf_sample *sample,
				     const char *enum_name);

That would return an array of strings that you could directly access,
indexing using some of the fields.

I.e. internally we would see the tracepoint format file as:

 	field:enum action vec;	offset:12;	size:4;	signed:0;

	enum: action: TIMER, NET_TX, NET_RX, BLOCK, BLOCK_IOPOLL, TASKLET, SCHED, HRTIMER, RCU

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ