All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Andi Kleen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: eranian@google.com, tglx@linutronix.de, namhyung@kernel.org,
	mingo@kernel.org, jolsa@redhat.com, acme@redhat.com,
	ak@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: [tip:perf/core] perf annotation: Add symbol__get_annotation
Date: Thu, 28 May 2015 02:32:14 -0700	[thread overview]
Message-ID: <tip-83be34a7a913bdf9f21f524333c63d9c48a28ef4@git.kernel.org> (raw)
In-Reply-To: <1432749114-904-4-git-send-email-andi@firstfloor.org>

Commit-ID:  83be34a7a913bdf9f21f524333c63d9c48a28ef4
Gitweb:     http://git.kernel.org/tip/83be34a7a913bdf9f21f524333c63d9c48a28ef4
Author:     Andi Kleen <ak@linux.intel.com>
AuthorDate: Wed, 27 May 2015 10:51:46 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 27 May 2015 20:30:56 -0300

perf annotation: Add symbol__get_annotation

Add a new utility function to get an function annotation out of existing
code.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1432749114-904-4-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 7f5bdfc..bf80430 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -506,6 +506,17 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
 	return 0;
 }
 
+static struct annotation *symbol__get_annotation(struct symbol *sym)
+{
+	struct annotation *notes = symbol__annotation(sym);
+
+	if (notes->src == NULL) {
+		if (symbol__alloc_hist(sym) < 0)
+			return NULL;
+	}
+	return notes;
+}
+
 static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
 				    int evidx, u64 addr)
 {
@@ -513,13 +524,9 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
 
 	if (sym == NULL)
 		return 0;
-
-	notes = symbol__annotation(sym);
-	if (notes->src == NULL) {
-		if (symbol__alloc_hist(sym) < 0)
-			return -ENOMEM;
-	}
-
+	notes = symbol__get_annotation(sym);
+	if (notes == NULL)
+		return -ENOMEM;
 	return __symbol__inc_addr_samples(sym, map, notes, evidx, addr);
 }
 

  reply	other threads:[~2015-05-28  9:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 17:51 Cycles annotation support for perf tools v2 Andi Kleen
2015-05-27 17:51 ` [PATCH 01/11] perf, tools: Add tools support for cycles, weight branch_info field Andi Kleen
2015-06-01 14:16   ` Jiri Olsa
2015-05-27 17:51 ` [PATCH 02/11] perf, tools, report: Add flag for non ANY branch mode Andi Kleen
2015-06-01 14:16   ` Jiri Olsa
2015-05-27 17:51 ` [PATCH 03/11] perf, tools: Add symbol__get_annotation Andi Kleen
2015-05-28  9:32   ` tip-bot for Andi Kleen [this message]
2015-06-01 14:17   ` Jiri Olsa
2015-05-27 17:51 ` [PATCH 04/11] perf, tools, report: Add infrastructure for a cycles histogram Andi Kleen
2015-06-01 14:19   ` Jiri Olsa
2015-05-27 17:51 ` [PATCH 05/11] perf, tools, report: Add processing for cycle histograms Andi Kleen
2015-06-01 14:10   ` Jiri Olsa
2015-05-27 17:51 ` [PATCH 06/11] perf, tools: Compute IPC and basic block cycles for annotate Andi Kleen
2015-05-27 17:51 ` [PATCH 07/11] perf, tools, annotate: Finally display IPC and cycle accounting Andi Kleen
2015-05-27 17:51 ` [PATCH 08/11] perf, tools, report: Move branch option parsing to own file Andi Kleen
2015-05-28  9:32   ` [tip:perf/core] perf tools: " tip-bot for Andi Kleen
2015-06-01 14:20   ` [PATCH 08/11] perf, tools, report: " Jiri Olsa
2015-05-27 17:51 ` [PATCH 09/11] perf, tools, top: Add branch annotation code to top Andi Kleen
2015-05-27 17:51 ` [PATCH 10/11] perf, tools, report: Display cycles in branch sort mode Andi Kleen
2015-05-27 17:51 ` [PATCH 11/11] test patch: Add fake branch cycles to input data in report/top Andi Kleen
2015-06-01 14:21 ` Cycles annotation support for perf tools v2 Jiri Olsa
2015-06-01 14:43   ` Arnaldo Carvalho de Melo

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=tip-83be34a7a913bdf9f21f524333c63d9c48a28ef4@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.