struct trace_lock_handler {
void (*acquire_event)(struct trace_acquire_event *,
- struct event_format *,
- int cpu,
- u64 timestamp,
- struct thread *thread);
+ const struct perf_sample *sample);
void (*acquired_event)(struct trace_acquired_event *,
- struct event_format *,
- int cpu,
- u64 timestamp,
- struct thread *thread);
+ const struct perf_sample *sample);
void (*contended_event)(struct trace_contended_event *,
- struct event_format *,
- int cpu,
- u64 timestamp,
- struct thread *thread);
+ const struct perf_sample *sample);
void (*release_event)(struct trace_release_event *,
- struct event_format *,
- int cpu,
- u64 timestamp,
- struct thread *thread);
+ const struct perf_sample *sample);
};
static struct lock_seq_stat *get_seq(struct thread_stat *ts, void *addr)
static void
report_lock_acquire_event(struct trace_acquire_event *acquire_event,
- struct event_format *__event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+ const struct perf_sample *sample)
{
struct lock_stat *ls;
struct thread_stat *ts;
if (ls->discard)
return;
- ts = thread_stat_findnew(thread->pid);
+ ts = thread_stat_findnew(sample->tid);
seq = get_seq(ts, acquire_event->addr);
switch (seq->state) {
}
ls->nr_acquire++;
- seq->prev_event_time = timestamp;
+ seq->prev_event_time = sample->time;
end:
return;
}
static void
report_lock_acquired_event(struct trace_acquired_event *acquired_event,
- struct event_format *__event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+ const struct perf_sample *sample)
{
+ u64 timestamp = sample->time;
struct lock_stat *ls;
struct thread_stat *ts;
struct lock_seq_stat *seq;
if (ls->discard)
return;
- ts = thread_stat_findnew(thread->pid);
+ ts = thread_stat_findnew(sample->tid);
seq = get_seq(ts, acquired_event->addr);
switch (seq->state) {
static void
report_lock_contended_event(struct trace_contended_event *contended_event,
- struct event_format *__event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+ const struct perf_sample *sample)
{
struct lock_stat *ls;
struct thread_stat *ts;
if (ls->discard)
return;
- ts = thread_stat_findnew(thread->pid);
+ ts = thread_stat_findnew(sample->tid);
seq = get_seq(ts, contended_event->addr);
switch (seq->state) {
seq->state = SEQ_STATE_CONTENDED;
ls->nr_contended++;
- seq->prev_event_time = timestamp;
+ seq->prev_event_time = sample->time;
end:
return;
}
static void
report_lock_release_event(struct trace_release_event *release_event,
- struct event_format *__event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+ const struct perf_sample *sample)
{
struct lock_stat *ls;
struct thread_stat *ts;
if (ls->discard)
return;
- ts = thread_stat_findnew(thread->pid);
+ ts = thread_stat_findnew(sample->tid);
seq = get_seq(ts, release_event->addr);
switch (seq->state) {
static struct trace_lock_handler *trace_handler;
-static void
-process_lock_acquire_event(void *data,
- struct event_format *event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+static void perf_evsel__process_lock_acquire(struct perf_evsel *evsel,
+ struct perf_sample *sample)
{
struct trace_acquire_event acquire_event;
+ struct event_format *event = evsel->tp_format;
+ void *data = sample->raw_data;
u64 tmp; /* this is required for casting... */
tmp = raw_field_value(event, "lockdep_addr", data);
acquire_event.flag = (int)raw_field_value(event, "flag", data);
if (trace_handler->acquire_event)
- trace_handler->acquire_event(&acquire_event, event, cpu, timestamp, thread);
+ trace_handler->acquire_event(&acquire_event, sample);
}
-static void
-process_lock_acquired_event(void *data,
- struct event_format *event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+static void perf_evsel__process_lock_acquired(struct perf_evsel *evsel,
+ struct perf_sample *sample)
{
struct trace_acquired_event acquired_event;
+ struct event_format *event = evsel->tp_format;
+ void *data = sample->raw_data;
u64 tmp; /* this is required for casting... */
tmp = raw_field_value(event, "lockdep_addr", data);
acquired_event.name = (char *)raw_field_ptr(event, "name", data);
if (trace_handler->acquire_event)
- trace_handler->acquired_event(&acquired_event, event, cpu, timestamp, thread);
+ trace_handler->acquired_event(&acquired_event, sample);
}
-static void
-process_lock_contended_event(void *data,
- struct event_format *event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+static void perf_evsel__process_lock_contended(struct perf_evsel *evsel,
+ struct perf_sample *sample)
{
struct trace_contended_event contended_event;
+ struct event_format *event = evsel->tp_format;
+ void *data = sample->raw_data;
u64 tmp; /* this is required for casting... */
tmp = raw_field_value(event, "lockdep_addr", data);
contended_event.name = (char *)raw_field_ptr(event, "name", data);
if (trace_handler->acquire_event)
- trace_handler->contended_event(&contended_event, event, cpu, timestamp, thread);
+ trace_handler->contended_event(&contended_event, sample);
}
-static void
-process_lock_release_event(void *data,
- struct event_format *event __used,
- int cpu __used,
- u64 timestamp __used,
- struct thread *thread __used)
+static void perf_evsel__process_lock_release(struct perf_evsel *evsel,
+ struct perf_sample *sample)
{
struct trace_release_event release_event;
+ struct event_format *event = evsel->tp_format;
+ void *data = sample->raw_data;
u64 tmp; /* this is required for casting... */
tmp = raw_field_value(event, "lockdep_addr", data);
release_event.name = (char *)raw_field_ptr(event, "name", data);
if (trace_handler->acquire_event)
- trace_handler->release_event(&release_event, event, cpu, timestamp, thread);
+ trace_handler->release_event(&release_event, sample);
}
-static void process_raw_event(struct perf_evsel *evsel, void *data, int cpu,
- u64 timestamp, struct thread *thread)
+static void perf_evsel__process_lock_event(struct perf_evsel *evsel,
+ struct perf_sample *sample)
{
struct event_format *event = evsel->tp_format;
if (!strcmp(event->name, "lock_acquire"))
- process_lock_acquire_event(data, event, cpu, timestamp, thread);
+ perf_evsel__process_lock_acquire(evsel, sample);
if (!strcmp(event->name, "lock_acquired"))
- process_lock_acquired_event(data, event, cpu, timestamp, thread);
+ perf_evsel__process_lock_acquired(evsel, sample);
if (!strcmp(event->name, "lock_contended"))
- process_lock_contended_event(data, event, cpu, timestamp, thread);
+ perf_evsel__process_lock_contended(evsel, sample);
if (!strcmp(event->name, "lock_release"))
- process_lock_release_event(data, event, cpu, timestamp, thread);
+ perf_evsel__process_lock_release(evsel, sample);
}
static void print_bad_events(int bad, int total)
return -1;
}
- process_raw_event(evsel, sample->raw_data, sample->cpu, sample->time, thread);
-
+ perf_evsel__process_lock_event(evsel, sample);
return 0;
}