Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1214748

Re: [PATCH V5 1/7] perf,tools: introduce generic FEAT for CPU attributes

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH V5 1/7] perf,tools: introduce generic FEAT for CPU attributes
Date 2015-08-27 20:00 +0200
Message-ID <q29CV-3ee-5@gated-at.bofh.it> (permalink)
References <q1pqq-3Do-5@gated-at.bofh.it> <q1pqq-3Do-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Aug 25, 2015 at 05:18:02AM -0400, Kan Liang wrote:

SNIP

>  
> +static int process_cpu_attributes(struct perf_file_section *section __maybe_unused,
> +				  struct perf_header *ph, int fd,
> +				  void *data __maybe_unused)
> +{
> +	ssize_t ret;
> +	u32 tag_id;
> +	u64 nr;
> +
> +
> +	ret = readn(fd, &tag_id, sizeof(tag_id));
> +	if (ret != sizeof(tag_id))
> +		return -1;
> +
> +	if (ph->needs_swap)
> +		nr = bswap_32(tag_id);
> +
> +	if (tag_id >= PERF_HEADER_CPU_ATTR_MAX) {
> +		pr_debug("The number of cpu attributes is not expected. "
> +			 "You may need to upgrade the perf tool.\n");
> +		return -1;
> +	}
> +
> +	ret = readn(fd, &nr, sizeof(nr));
> +	if (ret != sizeof(nr))
> +		return -1;
> +
> +	if (ph->needs_swap)
> +		nr = bswap_64(nr);
> +
> +	ph->env.cpu_attr[tag_id] = nr;

this should be in the loop right? process it PERF_HEADER_CPU_ATTR_MAX times

I understand it's enough for now when there's only single attr,
but could you please put it into the loop, so the next time
we add cpu attribute we dont need to add this logic?

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V5 1/7] perf,tools: introduce generic FEAT for CPU attributes Kan Liang <kan.liang@intel.com> - 2015-08-25 18:40 +0200
  Re: [PATCH V5 1/7] perf,tools: introduce generic FEAT for CPU  attributes Jiri Olsa <jolsa@redhat.com> - 2015-08-27 20:00 +0200
  Re: [PATCH V5 1/7] perf,tools: introduce generic FEAT for CPU  attributes Jiri Olsa <jolsa@redhat.com> - 2015-08-27 20:20 +0200

csiph-web