Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147330
b: refs/heads/master
c: 339f7c9
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 7, 2009
1 parent 76f2f78 commit c3491e6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ebb3c4c4cb81d64cc041356915ec015e2c57092a
refs/heads/master: 339f7c90b8a2f3aa2dd4267e79f797999e8a3c59
2 changes: 2 additions & 0 deletions trunk/include/linux/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ enum perf_counter_record_format {
PERF_RECORD_TID = 1U << 1,
PERF_RECORD_GROUP = 1U << 2,
PERF_RECORD_CALLCHAIN = 1U << 3,
PERF_RECORD_TIME = 1U << 4,
};

/*
Expand Down Expand Up @@ -221,6 +222,7 @@ enum perf_event_type {
__PERF_EVENT_TID = PERF_RECORD_TID,
__PERF_EVENT_GROUP = PERF_RECORD_GROUP,
__PERF_EVENT_CALLCHAIN = PERF_RECORD_CALLCHAIN,
__PERF_EVENT_TIME = PERF_RECORD_TIME,
};

#ifdef __KERNEL__
Expand Down
14 changes: 14 additions & 0 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,7 @@ static void perf_counter_output(struct perf_counter *counter,
} group_entry;
struct perf_callchain_entry *callchain = NULL;
int callchain_size = 0;
u64 time;

header.type = PERF_EVENT_COUNTER_OVERFLOW;
header.size = sizeof(header);
Expand Down Expand Up @@ -1862,6 +1863,16 @@ static void perf_counter_output(struct perf_counter *counter,
}
}

if (record_type & PERF_RECORD_TIME) {
/*
* Maybe do better on x86 and provide cpu_clock_nmi()
*/
time = sched_clock();

header.type |= __PERF_EVENT_TIME;
header.size += sizeof(u64);
}

ret = perf_output_begin(&handle, counter, header.size, nmi);
if (ret)
return;
Expand Down Expand Up @@ -1895,6 +1906,9 @@ static void perf_counter_output(struct perf_counter *counter,
if (callchain)
perf_output_copy(&handle, callchain, callchain_size);

if (record_type & PERF_RECORD_TIME)
perf_output_put(&handle, time);

perf_output_end(&handle);
}

Expand Down

0 comments on commit c3491e6

Please sign in to comment.