linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 01/19] perf, tools: Save max_x, max_y in xyarray
@ 2017-08-11 23:26 Andi Kleen
  2017-08-11 23:26 ` [PATCH v2 02/19] perf, tools: Fix buffer overflow while freeing events Andi Kleen
                   ` (20 more replies)
  0 siblings, 21 replies; 56+ messages in thread
From: Andi Kleen @ 2017-08-11 23:26 UTC (permalink / raw)
  To: acme; +Cc: jolsa, linux-kernel, Andi Kleen

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>
---
 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..785884158137 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 xy_max_y(struct xyarray *xy)
+{
+	return xy->max_x;
+}
+
+static inline int xy_max_x(struct xyarray *xy)
+{
+	return xy->max_y;
+}
+
 #endif /* _PERF_XYARRAY_H_ */
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2017-08-28 16:47 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11 23:26 [PATCH v2 01/19] perf, tools: Save max_x, max_y in xyarray Andi Kleen
2017-08-11 23:26 ` [PATCH v2 02/19] perf, tools: Fix buffer overflow while freeing events Andi Kleen
2017-08-22  8:20   ` Jiri Olsa
2017-08-24  8:19   ` [tip:perf/core] perf evsel: " tip-bot for Andi Kleen
2017-08-11 23:26 ` [PATCH v2 03/19] perf, tools, stat: Fix saved values rbtree lookup Andi Kleen
2017-08-11 23:26 ` [PATCH v2 04/19] perf, tools: Tighten detection of BPF events Andi Kleen
2017-08-22  8:20   ` Jiri Olsa
2017-08-22 15:00     ` Arnaldo Carvalho de Melo
2017-08-24  8:20   ` [tip:perf/core] perf bpf: " tip-bot for Andi Kleen
2017-08-11 23:26 ` [PATCH v2 05/19] perf, tools: Support weak groups Andi Kleen
2017-08-22  8:34   ` Jiri Olsa
2017-08-22 20:58     ` Andi Kleen
2017-08-23  7:40       ` Jiri Olsa
2017-08-22  8:36   ` Jiri Olsa
2017-08-22 21:00     ` Andi Kleen
2017-08-11 23:26 ` [PATCH v2 06/19] perf, tools: Add missing newline to expr parser error messages Andi Kleen
2017-08-11 23:26 ` [PATCH v2 07/19] perf, tools: Add utility function to detect SMT status Andi Kleen
2017-08-22  8:45   ` Jiri Olsa
2017-08-22 15:16     ` Arnaldo Carvalho de Melo
2017-08-24  8:20   ` [tip:perf/core] perf " tip-bot for Andi Kleen
2017-08-11 23:26 ` [PATCH v2 08/19] perf, tools: Expression parser enhancements for metrics Andi Kleen
2017-08-22  8:45   ` Jiri Olsa
2017-08-22 15:16     ` Arnaldo Carvalho de Melo
2017-08-23 17:43   ` Jiri Olsa
2017-08-24  8:21   ` [tip:perf/core] perf " tip-bot for Andi Kleen
2017-08-11 23:26 ` [PATCH v2 09/19] perf, tools: Increase maximum number of events in expressions Andi Kleen
2017-08-22  8:45   ` Jiri Olsa
2017-08-22 15:17     ` Arnaldo Carvalho de Melo
2017-08-24  8:21   ` [tip:perf/core] perf " tip-bot for Andi Kleen
2017-08-11 23:26 ` [PATCH v2 10/19] perf, tools: Dedup events in expression parsing Andi Kleen
2017-08-22  8:46   ` Jiri Olsa
2017-08-24  8:21   ` [tip:perf/core] perf " tip-bot for Andi Kleen
2017-08-11 23:26 ` [PATCH v2 11/19] perf, tools: Support metric_group and no event name in json parser Andi Kleen
2017-08-11 23:26 ` [PATCH v2 12/19] perf, tools, stat: Factor out generic metric printing Andi Kleen
2017-08-28  9:19   ` Jiri Olsa
2017-08-11 23:26 ` [PATCH v2 13/19] perf, tools: Print generic metric header even for failed expressions Andi Kleen
2017-08-11 23:26 ` [PATCH v2 14/19] perf, tools, stat: Support JSON metrics in perf stat Andi Kleen
2017-08-28  8:13   ` Jiri Olsa
2017-08-28  9:19     ` Jiri Olsa
2017-08-28  9:19   ` Jiri Olsa
2017-08-28 16:46     ` Andi Kleen
2017-08-11 23:26 ` [PATCH v2 15/19] perf, tools, list: Add metric groups to perf list Andi Kleen
2017-08-11 23:26 ` [PATCH v2 16/19] perf, tools, stat: Don't use ctx for saved values lookup Andi Kleen
2017-08-11 23:26 ` [PATCH v2 17/19] perf, tools, stat: Support duration_time for metrics Andi Kleen
2017-08-28  9:19   ` Jiri Olsa
2017-08-28 16:47     ` Andi Kleen
2017-08-11 23:26 ` [PATCH v2 18/19] perf, tools, stat: Hide internal duration_time counter Andi Kleen
2017-08-11 23:26 ` [PATCH v2 19/19] perf, tools, stat: Update walltime_nsecs_stats in interval mode Andi Kleen
2017-08-14 20:15 ` [PATCH v2 01/19] perf, tools: Save max_x, max_y in xyarray Jiri Olsa
2017-08-14 20:39   ` Andi Kleen
2017-08-14 21:12     ` Jiri Olsa
2017-08-22  8:20 ` Jiri Olsa
2017-08-22 14:40   ` Arnaldo Carvalho de Melo
2017-08-22 14:44     ` Jiri Olsa
2017-08-22 15:07       ` Arnaldo Carvalho de Melo
2017-08-24  8:19 ` [tip:perf/core] perf xyarray: Save max_x, max_y tip-bot for Andi Kleen

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).