From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: ak@linux.intel.com, tglx@linutronix.de, mingo@kernel.org,
dsahern@gmail.com, hpa@zytor.com, namhyung@kernel.org,
jolsa@kernel.org, a.p.zijlstra@chello.nl, acme@redhat.com,
linux-kernel@vger.kernel.org, eranian@google.com
Subject: [tip:perf/core] perf tools: Use ARRAY_SIZE in mem sort display functions
Date: Wed, 24 Feb 2016 21:43:20 -0800 [thread overview]
Message-ID: <tip-b19a1b6a233ede3ffc379b49e3653d6ce80dd743@git.kernel.org> (raw)
In-Reply-To: <1455525293-8671-13-git-send-email-jolsa@kernel.org>
Commit-ID: b19a1b6a233ede3ffc379b49e3653d6ce80dd743
Gitweb: http://git.kernel.org/tip/b19a1b6a233ede3ffc379b49e3653d6ce80dd743
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 15 Feb 2016 09:34:42 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 23 Feb 2016 12:19:10 -0300
perf tools: Use ARRAY_SIZE in mem sort display functions
There's no need to define extra macros for that.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1455525293-8671-13-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/sort.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 5f94ee7..5388f79 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -838,7 +838,6 @@ static const char * const tlb_access[] = {
"Walker",
"Fault",
};
-#define NUM_TLB_ACCESS (sizeof(tlb_access)/sizeof(const char *))
static int hist_entry__tlb_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
@@ -860,7 +859,7 @@ static int hist_entry__tlb_snprintf(struct hist_entry *he, char *bf,
/* already taken care of */
m &= ~(PERF_MEM_TLB_HIT|PERF_MEM_TLB_MISS);
- for (i = 0; m && i < NUM_TLB_ACCESS; i++, m >>= 1) {
+ for (i = 0; m && i < ARRAY_SIZE(tlb_access); i++, m >>= 1) {
if (!(m & 0x1))
continue;
if (l) {
@@ -915,7 +914,6 @@ static const char * const mem_lvl[] = {
"I/O",
"Uncached",
};
-#define NUM_MEM_LVL (sizeof(mem_lvl)/sizeof(const char *))
static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
@@ -937,7 +935,7 @@ static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
/* already taken care of */
m &= ~(PERF_MEM_LVL_HIT|PERF_MEM_LVL_MISS);
- for (i = 0; m && i < NUM_MEM_LVL; i++, m >>= 1) {
+ for (i = 0; m && i < ARRAY_SIZE(mem_lvl); i++, m >>= 1) {
if (!(m & 0x1))
continue;
if (l) {
@@ -983,7 +981,6 @@ static const char * const snoop_access[] = {
"Hit",
"HitM",
};
-#define NUM_SNOOP_ACCESS (sizeof(snoop_access)/sizeof(const char *))
static int hist_entry__snoop_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
@@ -998,7 +995,7 @@ static int hist_entry__snoop_snprintf(struct hist_entry *he, char *bf,
if (he->mem_info)
m = he->mem_info->data_src.mem_snoop;
- for (i = 0; m && i < NUM_SNOOP_ACCESS; i++, m >>= 1) {
+ for (i = 0; m && i < ARRAY_SIZE(snoop_access); i++, m >>= 1) {
if (!(m & 0x1))
continue;
if (l) {
next prev parent reply other threads:[~2016-02-25 6:27 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 8:34 [PATCH 00/23] perf tools: Several memory events updates Jiri Olsa
2016-02-15 8:34 ` [PATCH 01/23] perf record: Add --all-user/--all-kernel options Jiri Olsa
2016-02-16 16:56 ` Arnaldo Carvalho de Melo
2016-02-17 3:10 ` Andi Kleen
2016-02-17 14:26 ` Arnaldo Carvalho de Melo
2016-02-17 15:31 ` Andi Kleen
2016-02-17 14:39 ` Jiri Olsa
2016-02-17 14:55 ` Arnaldo Carvalho de Melo
2016-02-20 11:34 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15 8:34 ` [PATCH 02/23] perf tools: Make cl_address global Jiri Olsa
2016-02-25 5:42 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15 8:34 ` [PATCH 03/23] perf tools: Introduce cl_offset function Jiri Olsa
2016-02-25 5:42 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15 8:34 ` [PATCH 04/23] perf tools: Add monitored events array Jiri Olsa
2016-02-23 15:10 ` Arnaldo Carvalho de Melo
2016-02-23 15:18 ` Jiri Olsa
2016-02-25 5:42 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15 8:34 ` [PATCH 05/23] perf mem: Add -e record option Jiri Olsa
2016-02-25 5:43 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15 8:34 ` [PATCH 06/23] perf mem: Check for memory events support Jiri Olsa
2016-02-23 15:18 ` Arnaldo Carvalho de Melo
2016-02-23 15:24 ` Arnaldo Carvalho de Melo
2016-02-23 15:42 ` Jiri Olsa
2016-02-23 15:29 ` Jiri Olsa
2016-02-23 15:34 ` Arnaldo Carvalho de Melo
2016-02-15 8:34 ` [PATCH 07/23] perf mem: Introduce perf_mem_events__name function Jiri Olsa
2016-02-15 8:34 ` [PATCH 08/23] perf mem: Add -l/--ldlat option Jiri Olsa
2016-02-15 8:34 ` [PATCH 09/23] perf mem: Add -u/-k options Jiri Olsa
2016-02-15 8:34 ` [PATCH 10/23] perf x86 intel: Add DATALA events into sysfs Jiri Olsa
2016-02-15 8:34 ` [PATCH 11/23] perf mem: Add Intel DATALA memory events Jiri Olsa
2016-02-15 8:34 ` [PATCH 12/23] perf tools: Use ARRAY_SIZE in mem sort display functions Jiri Olsa
2016-02-25 5:43 ` tip-bot for Jiri Olsa [this message]
2016-02-15 8:34 ` [PATCH 13/23] perf tools: Introduce perf_mem__tlb_scnprintf function Jiri Olsa
2016-02-15 8:34 ` [PATCH 14/23] perf tools: Introduce perf_mem__lvl_scnprintf function Jiri Olsa
2016-02-15 8:34 ` [PATCH 15/23] perf tools: Introduce perf_mem__snp_scnprintf function Jiri Olsa
2016-02-15 8:34 ` [PATCH 16/23] perf tools: Introduce perf_mem__lck_scnprintf function Jiri Olsa
2016-02-15 8:34 ` [PATCH 17/23] perf tools: Change perf_mem__tlb_scnprintf to return nb of displayed bytes Jiri Olsa
2016-02-15 8:34 ` [PATCH 18/23] perf tools: Change perf_mem__lvl_scnprintf " Jiri Olsa
2016-02-15 8:34 ` [PATCH 19/23] perf tools: Change perf_mem__snp_scnprintf " Jiri Olsa
2016-02-15 8:34 ` [PATCH 20/23] perf tools: Change perf_mem__lck_scnprintf " Jiri Olsa
2016-02-15 8:34 ` [PATCH 21/23] perf script: Add data_src and weight column definitions Jiri Olsa
2016-02-25 5:43 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15 8:34 ` [PATCH 22/23] perf script: Display addr/data_src/weight columns for raw events Jiri Olsa
2016-02-25 5:43 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-02-15 8:34 ` [PATCH 23/23] perf script: Display data_src values Jiri Olsa
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-b19a1b6a233ede3ffc379b49e3653d6ce80dd743@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).