Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277282
b: refs/heads/master
c: 50a682c
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Nov 28, 2011
1 parent 397f977 commit 4397f68
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35b9d88ecd8c5fb720ba0dd325262f356d0b03e7
refs/heads/master: 50a682ce875f91e04c81ae5680535aba5a770bad
4 changes: 0 additions & 4 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,6 @@ static int __cmd_record(int argc, const char **argv)
perf_header__set_feat(&session->header, HEADER_NUMA_TOPOLOGY);
perf_header__set_feat(&session->header, HEADER_CPUID);

/* 512 kiB: default amount of unprivileged mlocked memory */
if (mmap_pages == UINT_MAX)
mmap_pages = (512 * 1024) / page_size;

if (forks) {
err = perf_evlist__prepare_workload(evsel_list, &record_opts, argv);
if (err < 0) {
Expand Down
12 changes: 9 additions & 3 deletions trunk/tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,14 +507,20 @@ static int perf_evlist__mmap_per_thread(struct perf_evlist *evlist, int prot, in
*
* Using perf_evlist__read_on_cpu does this automatically.
*/
int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite)
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
bool overwrite)
{
unsigned int page_size = sysconf(_SC_PAGE_SIZE);
int mask = pages * page_size - 1;
struct perf_evsel *evsel;
const struct cpu_map *cpus = evlist->cpus;
const struct thread_map *threads = evlist->threads;
int prot = PROT_READ | (overwrite ? 0 : PROT_WRITE);
int prot = PROT_READ | (overwrite ? 0 : PROT_WRITE), mask;

/* 512 kiB: default amount of unprivileged mlocked memory */
if (pages == UINT_MAX)
pages = (512 * 1024) / page_size;

mask = pages * page_size - 1;

if (evlist->mmap == NULL && perf_evlist__alloc_mmap(evlist) < 0)
return -ENOMEM;
Expand Down
3 changes: 2 additions & 1 deletion trunk/tools/perf/util/evlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist,
int perf_evlist__start_workload(struct perf_evlist *evlist);

int perf_evlist__alloc_mmap(struct perf_evlist *evlist);
int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
bool overwrite);
void perf_evlist__munmap(struct perf_evlist *evlist);

void perf_evlist__disable(struct perf_evlist *evlist);
Expand Down

0 comments on commit 4397f68

Please sign in to comment.