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]
Message-ID: <87oblc9fyn.fsf@sejong.aot.lge.com>
Date:	Wed, 12 Sep 2012 10:40:00 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...radead.org>
Cc:	Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 16/18] perf evsel: Introduce perf_evsel__{str,int}val methods

On Tue, 11 Sep 2012 20:53:08 -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@...hat.com>
>
> Wrappers to the libtraceevent routines, so that we can further reduce
> the surface contact perf builtins have with it.
[snip]
> +char *perf_evsel__strval(struct perf_evsel *evsel, struct perf_sample *sample,
> +			 const char *name)
> +{
> +	struct format_field *field = pevent_find_field(evsel->tp_format, name);
> +	int offset;
> +
> +        if (!field)
> +                return NULL;

Whitespace problem?

Btw, as a generic wrapper shouldn't it handle common fields also?  If
you care about performance, how about switching the order of finding
fields in question, i.e.:

	struct format_field *field = pevent_find_field(evsel->tp_format, name);

	if (!field) {
		field = pevent_find_common_field(evsel->tp_format, name);
		if (!field)
			return NULL;
	}

> +
> +	offset = field->offset;
> +
> +	if (field->flags & FIELD_IS_DYNAMIC) {
> +		offset = *(int *)(sample->raw_data + field->offset);
> +		offset &= 0xffff;
> +	}
> +
> +	return sample->raw_data + offset;
> +}
> +
> +u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample,
> +		       const char *name)
> +{
> +	struct format_field *field = pevent_find_field(evsel->tp_format, name);
> +	u64 val;
> +
> +        if (!field)
> +                return 0;

Ditto.

Thanks,
Namhyung

> +
> +	val = pevent_read_number(evsel->tp_format->pevent,
> +				 sample->raw_data + field->offset, field->size);
> +	return val;
> +
> +}
--
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