mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Stephane Eranian <eranian@google.com>, linux-kernel@vger.kernel.org
Cc: acme@redhat.com, peterz@infradead.org, mingo@elte.hu,
	ak@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org,
	cel@us.ibm.com, sukadev@linux.vnet.ibm.com,
	sonnyrao@chromium.org, johnmccutchan@google.com,
	dsahern@gmail.com, pawel.moll@arm.com
Subject: Re: [PATCH v4 3/4] perf inject: add jitdump mmap injection support
Date: Thu, 26 Mar 2015 10:00:12 +0200	[thread overview]
Message-ID: <5513BC8C.7090102@intel.com> (raw)
In-Reply-To: <1427235933-949-4-git-send-email-eranian@google.com>

<SNIP>

> +static int
> +jit_open(struct jit_buf_desc *jd, const char *name)
> +{
> +	struct jitheader header;
> +	struct jr_prefix *prefix;
> +	ssize_t bs, bsz = 0;
> +	void *n, *buf = NULL;
> +	int ret, retval = -1;
> +
> +	jd->in = fopen(name, "r");
> +	if (!jd->in)
> +		return -1;
> +
> +	bsz = hmax(sizeof(header), sizeof(*prefix));
> +
> +	buf = malloc(bsz);
> +	if (!buf)
> +		goto error;
> +
> +	ret = fread(buf, sizeof(header), 1, jd->in);
> +	if (ret != 1)
> +		goto error;
> +
> +	memcpy(&header, buf, sizeof(header));
> +
> +	if (header.magic != JITHEADER_MAGIC) {
> +		if (header.magic != JITHEADER_MAGIC_SW)
> +			goto error;
> +		jd->needs_bswap = 1;
> +	}
> +
> +	if (jd->needs_bswap) {
> +		header.version    = bswap_32(header.version);
> +		header.total_size = bswap_32(header.total_size);
> +		header.pid	  = bswap_32(header.pid);
> +		header.elf_mach   = bswap_32(header.elf_mach);
> +		header.timestamp  = bswap_32(header.timestamp);

timestamp is 64-bit



  parent reply	other threads:[~2015-03-26  8:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 22:25 [PATCH v4 0/4] perf: add support for profiling jitted code Stephane Eranian
2015-03-24 22:25 ` [PATCH v4 1/4] perf: Use monotonic clock as a source for timestamps Stephane Eranian
2015-03-24 22:25 ` [PATCH v4 2/4] perf tools: add Java demangling support Stephane Eranian
2015-03-25 20:34   ` Carl E. Love
2015-03-26  0:57     ` Stephane Eranian
2015-03-26  1:03       ` David Ahern
2015-03-25 22:18   ` Arnaldo Carvalho de Melo
2015-03-24 22:25 ` [PATCH v4 3/4] perf inject: add jitdump mmap injection support Stephane Eranian
2015-03-25 20:41   ` Carl E. Love
2015-03-25 22:15     ` David Ahern
2015-03-25 21:17   ` Carl E. Love
2015-03-26  8:00   ` Adrian Hunter [this message]
2015-03-24 22:25 ` [PATCH v4 4/4] perf tools: add JVMTI agent library Stephane Eranian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5513BC8C.7090102@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=cel@us.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=johnmccutchan@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=peterz@infradead.org \
    --cc=sonnyrao@chromium.org \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome