Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Introduce xyarray__reset function

To zero all the xyarray contents. It will be used in following patches.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
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/1434269985-521-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
b45f65e8 ba7ecb02

+10
+8
tools/perf/util/xyarray.c
··· 9 9 if (xy != NULL) { 10 10 xy->entry_size = entry_size; 11 11 xy->row_size = row_size; 12 + xy->entries = xlen * ylen; 12 13 } 13 14 14 15 return xy; 16 + } 17 + 18 + void xyarray__reset(struct xyarray *xy) 19 + { 20 + size_t n = xy->entries * xy->entry_size; 21 + 22 + memset(xy->contents, 0, n); 15 23 } 16 24 17 25 void xyarray__delete(struct xyarray *xy)
+2
tools/perf/util/xyarray.h
··· 6 6 struct xyarray { 7 7 size_t row_size; 8 8 size_t entry_size; 9 + size_t entries; 9 10 char contents[]; 10 11 }; 11 12 12 13 struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size); 13 14 void xyarray__delete(struct xyarray *xy); 15 + void xyarray__reset(struct xyarray *xy); 14 16 15 17 static inline void *xyarray__entry(struct xyarray *xy, int x, int y) 16 18 {