linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 01/15] perf xyarray: Save max_x, max_y
Date: Wed, 23 Aug 2017 16:36:00 -0300	[thread overview]
Message-ID: <20170823193614.20394-2-acme@kernel.org> (raw)
In-Reply-To: <20170823193614.20394-1-acme@kernel.org>

From: Andi Kleen <ak@linux.intel.com>

Save the original array dimensions in xyarrays, so that users can
retrieve them later. Add some inline functions to access these fields.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20170811232634.30465-1-andi@firstfloor.org
[ As noticed by Jiri, fix up namespacing: xy__method() -> xyarray__method() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/xyarray.c |  2 ++
 tools/perf/util/xyarray.h | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/tools/perf/util/xyarray.c b/tools/perf/util/xyarray.c
index 7251fdbabced..c8f415d9877b 100644
--- a/tools/perf/util/xyarray.c
+++ b/tools/perf/util/xyarray.c
@@ -12,6 +12,8 @@ struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size)
 		xy->entry_size = entry_size;
 		xy->row_size   = row_size;
 		xy->entries    = xlen * ylen;
+		xy->max_x      = xlen;
+		xy->max_y      = ylen;
 	}
 
 	return xy;
diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h
index 7f30af371b7e..4ba726c90870 100644
--- a/tools/perf/util/xyarray.h
+++ b/tools/perf/util/xyarray.h
@@ -7,6 +7,8 @@ struct xyarray {
 	size_t row_size;
 	size_t entry_size;
 	size_t entries;
+	size_t max_x;
+	size_t max_y;
 	char contents[];
 };
 
@@ -19,4 +21,14 @@ static inline void *xyarray__entry(struct xyarray *xy, int x, int y)
 	return &xy->contents[x * xy->row_size + y * xy->entry_size];
 }
 
+static inline int xyarray__max_y(struct xyarray *xy)
+{
+	return xy->max_x;
+}
+
+static inline int xyarray__max_x(struct xyarray *xy)
+{
+	return xy->max_y;
+}
+
 #endif /* _PERF_XYARRAY_H_ */
-- 
2.13.5

  reply	other threads:[~2017-08-23 19:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 19:35 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-08-23 19:36 ` Arnaldo Carvalho de Melo [this message]
2017-08-23 19:36 ` [PATCH 02/15] perf evsel: Fix buffer overflow while freeing events Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 03/15] perf bpf: Tighten detection of BPF events Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 04/15] perf tools: Add utility function to detect SMT status Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 05/15] perf tools: Expression parser enhancements for metrics Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 06/15] perf tools: Increase maximum number of events in expressions Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 07/15] perf tools: Dedup events in expression parsing Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 08/15] perf vendor events: Add core event list for Skylake Server Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 09/15] perf vendor events: Add Skylake server uncore event list Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 10/15] perf tools: Add support for printing new mem_info encodings Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 11/15] perf test: Add test cases for new data source encoding Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 12/15] perf tools: Really install manpages via 'make install-man' Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 13/15] perf: Fix documentation for sysctls perf_event_paranoid and perf_event_mlock_kb Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 14/15] perf tools: Fix static linking with libdw from elfutils Arnaldo Carvalho de Melo
2017-08-23 19:36 ` [PATCH 15/15] perf tools: Fix static linking with libunwind 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=20170823193614.20394-2-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    /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).