-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf callchain: Separate perf_reg_value function in perf_regs object
Making perf_reg_value function global (formely reg_value), because it's going to be used globaly across all code providing the dwarf post unwind feature. Changing its prototype to be generic: -int reg_value(unw_word_t *valp, struct regs_dump *regs, int id) +int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); Changing the valp type from libunwind specific 'unw_word_t' to u64. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Jean Pihet <jean.pihet@linaro.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jean Pihet <jean.pihet@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1389098853-14466-13-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Jiri Olsa
authored and
Arnaldo Carvalho de Melo
committed
Feb 18, 2014
1 parent
9ff125d
commit c9b951c
Showing
4 changed files
with
45 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <errno.h> | ||
#include "perf_regs.h" | ||
|
||
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) | ||
{ | ||
int i, idx = 0; | ||
u64 mask = regs->mask; | ||
|
||
if (!(mask & (1 << id))) | ||
return -EINVAL; | ||
|
||
for (i = 0; i < id; i++) { | ||
if (mask & (1 << i)) | ||
idx++; | ||
} | ||
|
||
*valp = regs->regs[idx]; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
#ifndef __PERF_REGS_H | ||
#define __PERF_REGS_H | ||
|
||
#include "types.h" | ||
#include "event.h" | ||
|
||
#ifdef HAVE_PERF_REGS_SUPPORT | ||
#include <perf_regs.h> | ||
|
||
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); | ||
|
||
#else | ||
#define PERF_REGS_MASK 0 | ||
|
||
static inline const char *perf_reg_name(int id __maybe_unused) | ||
{ | ||
return NULL; | ||
} | ||
|
||
static inline int perf_reg_value(u64 *valp __maybe_unused, | ||
struct regs_dump *regs __maybe_unused, | ||
int id __maybe_unused) | ||
{ | ||
return 0; | ||
} | ||
#endif /* HAVE_PERF_REGS_SUPPORT */ | ||
#endif /* __PERF_REGS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters