Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350061
b: refs/heads/master
c: 0479b8b
h: refs/heads/master
i:
  350059: aa6da8a
v: v3
  • Loading branch information
David Ahern authored and Arnaldo Carvalho de Melo committed Feb 6, 2013
1 parent 62986f3 commit 1dd7067
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 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: 5936f54d6ca2857d81188dcdff8c61b8fc482f53
refs/heads/master: 0479b8b9cf4377df5d2c81506ce93326c31eff40
26 changes: 0 additions & 26 deletions trunk/tools/perf/perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,32 +103,6 @@
#include "util/types.h"
#include <stdbool.h>

struct perf_mmap {
void *base;
int mask;
unsigned int prev;
};

static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
{
struct perf_event_mmap_page *pc = mm->base;
int head = pc->data_head;
rmb();
return head;
}

static inline void perf_mmap__write_tail(struct perf_mmap *md,
unsigned long tail)
{
struct perf_event_mmap_page *pc = md->base;

/*
* ensure all reads are done before we write the tail out.
*/
/* mb(); */
pc->data_tail = tail;
}

/*
* prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
* counters in the current task.
Expand Down
4 changes: 2 additions & 2 deletions trunk/tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
if ((old & md->mask) + size != ((old + size) & md->mask)) {
unsigned int offset = old;
unsigned int len = min(sizeof(*event), size), cpy;
void *dst = &evlist->event_copy;
void *dst = &md->event_copy;

do {
cpy = min(md->mask + 1 - (offset & md->mask), len);
Expand All @@ -385,7 +385,7 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
len -= cpy;
} while (len);

event = &evlist->event_copy;
event = &md->event_copy;
}

old += size;
Expand Down
29 changes: 28 additions & 1 deletion trunk/tools/perf/util/evlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ struct perf_record_opts;
#define PERF_EVLIST__HLIST_BITS 8
#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)

struct perf_mmap {
void *base;
int mask;
unsigned int prev;
union perf_event event_copy;
};

struct perf_evlist {
struct list_head entries;
struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
Expand All @@ -30,7 +37,6 @@ struct perf_evlist {
pid_t pid;
} workload;
bool overwrite;
union perf_event event_copy;
struct perf_mmap *mmap;
struct pollfd *pollfd;
struct thread_map *threads;
Expand Down Expand Up @@ -136,4 +142,25 @@ static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist)
}

size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp);

static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
{
struct perf_event_mmap_page *pc = mm->base;
int head = pc->data_head;
rmb();
return head;
}

static inline void perf_mmap__write_tail(struct perf_mmap *md,
unsigned long tail)
{
struct perf_event_mmap_page *pc = md->base;

/*
* ensure all reads are done before we write the tail out.
*/
/* mb(); */
pc->data_tail = tail;
}

#endif /* __PERF_EVLIST_H */

0 comments on commit 1dd7067

Please sign in to comment.