Commit 894e8d08 authored by Ingo Molnar's avatar Ingo Molnar

Merge branch 'tip/perf/core' of...

Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core

Pull perf optimizations from Steve Rostedt.
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents c9572f01 d027e6a9
...@@ -57,7 +57,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_template, ...@@ -57,7 +57,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
TP_PROTO(struct task_struct *p, int success), TP_PROTO(struct task_struct *p, int success),
TP_ARGS(p, success), TP_ARGS(__perf_task(p), success),
TP_STRUCT__entry( TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN ) __array( char, comm, TASK_COMM_LEN )
...@@ -73,9 +73,6 @@ DECLARE_EVENT_CLASS(sched_wakeup_template, ...@@ -73,9 +73,6 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
__entry->prio = p->prio; __entry->prio = p->prio;
__entry->success = success; __entry->success = success;
__entry->target_cpu = task_cpu(p); __entry->target_cpu = task_cpu(p);
)
TP_perf_assign(
__perf_task(p);
), ),
TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d", TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d",
...@@ -313,7 +310,7 @@ DECLARE_EVENT_CLASS(sched_stat_template, ...@@ -313,7 +310,7 @@ DECLARE_EVENT_CLASS(sched_stat_template,
TP_PROTO(struct task_struct *tsk, u64 delay), TP_PROTO(struct task_struct *tsk, u64 delay),
TP_ARGS(tsk, delay), TP_ARGS(__perf_task(tsk), __perf_count(delay)),
TP_STRUCT__entry( TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN ) __array( char, comm, TASK_COMM_LEN )
...@@ -325,10 +322,6 @@ DECLARE_EVENT_CLASS(sched_stat_template, ...@@ -325,10 +322,6 @@ DECLARE_EVENT_CLASS(sched_stat_template,
memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
__entry->pid = tsk->pid; __entry->pid = tsk->pid;
__entry->delay = delay; __entry->delay = delay;
)
TP_perf_assign(
__perf_count(delay);
__perf_task(tsk);
), ),
TP_printk("comm=%s pid=%d delay=%Lu [ns]", TP_printk("comm=%s pid=%d delay=%Lu [ns]",
...@@ -372,11 +365,11 @@ DEFINE_EVENT(sched_stat_template, sched_stat_blocked, ...@@ -372,11 +365,11 @@ DEFINE_EVENT(sched_stat_template, sched_stat_blocked,
* Tracepoint for accounting runtime (time the task is executing * Tracepoint for accounting runtime (time the task is executing
* on a CPU). * on a CPU).
*/ */
TRACE_EVENT(sched_stat_runtime, DECLARE_EVENT_CLASS(sched_stat_runtime,
TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
TP_ARGS(tsk, runtime, vruntime), TP_ARGS(tsk, __perf_count(runtime), vruntime),
TP_STRUCT__entry( TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN ) __array( char, comm, TASK_COMM_LEN )
...@@ -390,9 +383,6 @@ TRACE_EVENT(sched_stat_runtime, ...@@ -390,9 +383,6 @@ TRACE_EVENT(sched_stat_runtime,
__entry->pid = tsk->pid; __entry->pid = tsk->pid;
__entry->runtime = runtime; __entry->runtime = runtime;
__entry->vruntime = vruntime; __entry->vruntime = vruntime;
)
TP_perf_assign(
__perf_count(runtime);
), ),
TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]",
...@@ -401,6 +391,10 @@ TRACE_EVENT(sched_stat_runtime, ...@@ -401,6 +391,10 @@ TRACE_EVENT(sched_stat_runtime,
(unsigned long long)__entry->vruntime) (unsigned long long)__entry->vruntime)
); );
DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime,
TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
TP_ARGS(tsk, runtime, vruntime));
/* /*
* Tracepoint for showing priority inheritance modifying a tasks * Tracepoint for showing priority inheritance modifying a tasks
* priority. * priority.
......
...@@ -507,8 +507,14 @@ static inline notrace int ftrace_get_offsets_##call( \ ...@@ -507,8 +507,14 @@ static inline notrace int ftrace_get_offsets_##call( \
#undef TP_fast_assign #undef TP_fast_assign
#define TP_fast_assign(args...) args #define TP_fast_assign(args...) args
#undef TP_perf_assign #undef __perf_addr
#define TP_perf_assign(args...) #define __perf_addr(a) (a)
#undef __perf_count
#define __perf_count(c) (c)
#undef __perf_task
#define __perf_task(t) (t)
#undef DECLARE_EVENT_CLASS #undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
...@@ -636,16 +642,13 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call ...@@ -636,16 +642,13 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
#define __get_str(field) (char *)__get_dynamic_array(field) #define __get_str(field) (char *)__get_dynamic_array(field)
#undef __perf_addr #undef __perf_addr
#define __perf_addr(a) __addr = (a) #define __perf_addr(a) (__addr = (a))
#undef __perf_count #undef __perf_count
#define __perf_count(c) __count = (c) #define __perf_count(c) (__count = (c))
#undef __perf_task #undef __perf_task
#define __perf_task(t) __task = (t) #define __perf_task(t) (__task = (t))
#undef TP_perf_assign
#define TP_perf_assign(args...) args
#undef DECLARE_EVENT_CLASS #undef DECLARE_EVENT_CLASS
#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
...@@ -663,15 +666,20 @@ perf_trace_##call(void *__data, proto) \ ...@@ -663,15 +666,20 @@ perf_trace_##call(void *__data, proto) \
int __data_size; \ int __data_size; \
int rctx; \ int rctx; \
\ \
perf_fetch_caller_regs(&__regs); \
\
__data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
\
head = this_cpu_ptr(event_call->perf_events); \
if (__builtin_constant_p(!__task) && !__task && \
hlist_empty(head)) \
return; \
\
__entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
sizeof(u64)); \ sizeof(u64)); \
__entry_size -= sizeof(u32); \ __entry_size -= sizeof(u32); \
\ \
entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \ perf_fetch_caller_regs(&__regs); \
__entry_size, event_call->event.type, &__regs, &rctx); \ entry = perf_trace_buf_prepare(__entry_size, \
event_call->event.type, &__regs, &rctx); \
if (!entry) \ if (!entry) \
return; \ return; \
\ \
...@@ -679,7 +687,6 @@ perf_trace_##call(void *__data, proto) \ ...@@ -679,7 +687,6 @@ perf_trace_##call(void *__data, proto) \
\ \
{ assign; } \ { assign; } \
\ \
head = this_cpu_ptr(event_call->perf_events); \
perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \
__count, &__regs, head, __task); \ __count, &__regs, head, __task); \
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment