mirror of https://gitee.com/openkylin/linux.git
perf tools: Have the page size value available for all tools
Its such a common need that we might as well have a global with that value. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-mwfqji9f17k5j81l1404dk3q@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
6e92349d5a
commit
0c1fe6b2f3
|
@ -35,7 +35,6 @@ static int test__vmlinux_matches_kallsyms(void)
|
||||||
struct map *kallsyms_map, *vmlinux_map;
|
struct map *kallsyms_map, *vmlinux_map;
|
||||||
struct machine kallsyms, vmlinux;
|
struct machine kallsyms, vmlinux;
|
||||||
enum map_type type = MAP__FUNCTION;
|
enum map_type type = MAP__FUNCTION;
|
||||||
long page_size = sysconf(_SC_PAGE_SIZE);
|
|
||||||
struct ref_reloc_sym ref_reloc_sym = { .name = "_stext", };
|
struct ref_reloc_sym ref_reloc_sym = { .name = "_stext", };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1007,7 +1006,6 @@ static void segfault_handler(int sig __maybe_unused,
|
||||||
|
|
||||||
static int __test__rdpmc(void)
|
static int __test__rdpmc(void)
|
||||||
{
|
{
|
||||||
long page_size = sysconf(_SC_PAGE_SIZE);
|
|
||||||
volatile int tmp = 0;
|
volatile int tmp = 0;
|
||||||
u64 i, loops = 1000;
|
u64 i, loops = 1000;
|
||||||
int n;
|
int n;
|
||||||
|
|
|
@ -440,6 +440,8 @@ int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
|
|
||||||
|
page_size = sysconf(_SC_PAGE_SIZE);
|
||||||
|
|
||||||
cmd = perf_extract_argv0_path(argv[0]);
|
cmd = perf_extract_argv0_path(argv[0]);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
cmd = "perf-help";
|
cmd = "perf-help";
|
||||||
|
|
|
@ -325,8 +325,6 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
|
||||||
|
|
||||||
union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
|
union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
|
||||||
{
|
{
|
||||||
/* XXX Move this to perf.c, making it generally available */
|
|
||||||
unsigned int page_size = sysconf(_SC_PAGE_SIZE);
|
|
||||||
struct perf_mmap *md = &evlist->mmap[idx];
|
struct perf_mmap *md = &evlist->mmap[idx];
|
||||||
unsigned int head = perf_mmap__read_head(md);
|
unsigned int head = perf_mmap__read_head(md);
|
||||||
unsigned int old = md->prev;
|
unsigned int old = md->prev;
|
||||||
|
@ -528,7 +526,6 @@ static int perf_evlist__mmap_per_thread(struct perf_evlist *evlist, int prot, in
|
||||||
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
|
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
|
||||||
bool overwrite)
|
bool overwrite)
|
||||||
{
|
{
|
||||||
unsigned int page_size = sysconf(_SC_PAGE_SIZE);
|
|
||||||
struct perf_evsel *evsel;
|
struct perf_evsel *evsel;
|
||||||
const struct cpu_map *cpus = evlist->cpus;
|
const struct cpu_map *cpus = evlist->cpus;
|
||||||
const struct thread_map *threads = evlist->threads;
|
const struct thread_map *threads = evlist->threads;
|
||||||
|
|
|
@ -1375,15 +1375,13 @@ int __perf_session__process_events(struct perf_session *session,
|
||||||
{
|
{
|
||||||
u64 head, page_offset, file_offset, file_pos, progress_next;
|
u64 head, page_offset, file_offset, file_pos, progress_next;
|
||||||
int err, mmap_prot, mmap_flags, map_idx = 0;
|
int err, mmap_prot, mmap_flags, map_idx = 0;
|
||||||
size_t page_size, mmap_size;
|
size_t mmap_size;
|
||||||
char *buf, *mmaps[8];
|
char *buf, *mmaps[8];
|
||||||
union perf_event *event;
|
union perf_event *event;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
perf_tool__fill_defaults(tool);
|
perf_tool__fill_defaults(tool);
|
||||||
|
|
||||||
page_size = sysconf(_SC_PAGESIZE);
|
|
||||||
|
|
||||||
page_offset = page_size * (data_offset / page_size);
|
page_offset = page_size * (data_offset / page_size);
|
||||||
file_offset = page_offset;
|
file_offset = page_offset;
|
||||||
head = data_offset - page_offset;
|
head = data_offset - page_offset;
|
||||||
|
|
|
@ -47,8 +47,6 @@ int file_bigendian;
|
||||||
int host_bigendian;
|
int host_bigendian;
|
||||||
static int long_size;
|
static int long_size;
|
||||||
|
|
||||||
static unsigned long page_size;
|
|
||||||
|
|
||||||
static ssize_t calc_data_size;
|
static ssize_t calc_data_size;
|
||||||
static bool repipe;
|
static bool repipe;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
/*
|
/*
|
||||||
* XXX We need to find a better place for these things...
|
* XXX We need to find a better place for these things...
|
||||||
*/
|
*/
|
||||||
|
unsigned int page_size;
|
||||||
|
|
||||||
bool perf_host = true;
|
bool perf_host = true;
|
||||||
bool perf_guest = false;
|
bool perf_guest = false;
|
||||||
|
|
||||||
|
|
|
@ -263,4 +263,6 @@ char *rtrim(char *s);
|
||||||
|
|
||||||
void dump_stack(void);
|
void dump_stack(void);
|
||||||
|
|
||||||
|
extern unsigned int page_size;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue