Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147676
b: refs/heads/master
c: b2fef07
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Jun 5, 2009
1 parent 85f3b63 commit eddca65
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 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: 6a24ed6c6082ec65d19331a4bfa30c0512a1a822
refs/heads/master: b2fef0762fdb65cf8702eea93f4e58abeb0ecefc
2 changes: 1 addition & 1 deletion trunk/Documentation/perf_counter/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
memset(&attr, 0, sizeof(attr));
attr.config = event_id[counter];
attr.sample_period = event_count[counter];
attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_PERIOD;
attr.freq = freq;
attr.mmap = track;
attr.comm = track;
Expand Down
39 changes: 33 additions & 6 deletions trunk/Documentation/perf_counter/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,20 @@ struct fork_event {
__u32 pid, ppid;
};

typedef union event_union {
struct period_event {
struct perf_event_header header;
struct ip_event ip;
struct mmap_event mmap;
struct comm_event comm;
struct fork_event fork;
__u64 time;
__u64 id;
__u64 sample_period;
};

typedef union event_union {
struct perf_event_header header;
struct ip_event ip;
struct mmap_event mmap;
struct comm_event comm;
struct fork_event fork;
struct period_event period;
} event_t;

static LIST_HEAD(dsos);
Expand Down Expand Up @@ -1052,6 +1060,19 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
return 0;
}

static int
process_period_event(event_t *event, unsigned long offset, unsigned long head)
{
dprintf("%p [%p]: PERF_EVENT_PERIOD: time:%Ld, id:%Ld: period:%Ld\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
event->period.time,
event->period.id,
event->period.sample_period);

return 0;
}

static int
process_event(event_t *event, unsigned long offset, unsigned long head)
{
Expand All @@ -1068,11 +1089,12 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
case PERF_EVENT_FORK:
return process_fork_event(event, offset, head);

case PERF_EVENT_PERIOD:
return process_period_event(event, offset, head);
/*
* We dont process them right now but they are fine:
*/

case PERF_EVENT_PERIOD:
case PERF_EVENT_THROTTLE:
case PERF_EVENT_UNTHROTTLE:
return 0;
Expand Down Expand Up @@ -1157,6 +1179,11 @@ static int __cmd_report(void)

size = event->header.size;

dprintf("%p [%p]: event: %d\n",
(void *)(offset + head),
(void *)(long)event->header.size,
event->header.type);

if (!size || process_event(event, offset, head) < 0) {

dprintf("%p [%p]: skipping unknown header type: %d\n",
Expand Down

0 comments on commit eddca65

Please sign in to comment.