Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147312
b: refs/heads/master
c: 5ed0041
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 6, 2009
1 parent 3e01645 commit f98f0be
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 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: 78d613eb129fc4edf0e2cabfcc6a4c5285482d21
refs/heads/master: 5ed00415e304203a0a9dcaef226d6d3f1106070e
6 changes: 4 additions & 2 deletions trunk/include/linux/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,15 @@ struct perf_event_header {
};

enum perf_event_type {
PERF_EVENT_IP = 0,

PERF_EVENT_GROUP = 1,

PERF_EVENT_MMAP = 2,
PERF_EVENT_MUNMAP = 3,

__PERF_EVENT_TID = 0x100,
PERF_EVENT_OVERFLOW = 1UL << 31,
__PERF_EVENT_IP = 1UL << 30,
__PERF_EVENT_TID = 1UL << 29,
};

#ifdef __KERNEL__
Expand Down
56 changes: 25 additions & 31 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,50 +1754,44 @@ static void perf_output_end(struct perf_output_handle *handle)
rcu_read_unlock();
}

static int perf_output_write(struct perf_counter *counter, int nmi,
void *buf, ssize_t size)
{
struct perf_output_handle handle;
int ret;

ret = perf_output_begin(&handle, counter, size, nmi);
if (ret)
goto out;

perf_output_copy(&handle, buf, size);
perf_output_end(&handle);

out:
return ret;
}

static void perf_output_simple(struct perf_counter *counter,
int nmi, struct pt_regs *regs)
{
unsigned int size;
int ret;
struct perf_output_handle handle;
struct perf_event_header header;
u64 ip;
struct {
struct perf_event_header header;
u64 ip;
u32 pid, tid;
} event;
} tid_entry;

event.header.type = PERF_EVENT_IP;
event.ip = instruction_pointer(regs);
header.type = PERF_EVENT_OVERFLOW;
header.size = sizeof(header);

size = sizeof(event);
ip = instruction_pointer(regs);
header.type |= __PERF_EVENT_IP;
header.size += sizeof(ip);

if (counter->hw_event.include_tid) {
/* namespace issues */
event.pid = current->group_leader->pid;
event.tid = current->pid;
tid_entry.pid = current->group_leader->pid;
tid_entry.tid = current->pid;

event.header.type |= __PERF_EVENT_TID;
} else
size -= sizeof(u64);
header.type |= __PERF_EVENT_TID;
header.size += sizeof(tid_entry);
}

event.header.size = size;
ret = perf_output_begin(&handle, counter, header.size, nmi);
if (ret)
return;

perf_output_put(&handle, header);
perf_output_put(&handle, ip);

if (counter->hw_event.include_tid)
perf_output_put(&handle, tid_entry);

perf_output_write(counter, nmi, &event, size);
perf_output_end(&handle);
}

static void perf_output_group(struct perf_counter *counter, int nmi)
Expand Down

0 comments on commit f98f0be

Please sign in to comment.