Re: [PATCH 1/1] tracing, workqueuetrace: Make workqueue tracepoints use TRACE_EVENT macro

From: KOSAKI Motohiro
Date: Sun Apr 12 2009 - 21:44:47 EST


Hi,

hehe, I also have similar patch in my local patch queue ;)

> +TRACE_EVENT(workqueue_insertion,
> +
> + TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
> +
> + TP_ARGS(wq_thread, work),
> +
> + TP_STRUCT__entry(
> + __array( char, thread_comm, TASK_COMM_LEN )
> + __field( pid_t, thread_pid )
> + __field( struct work_struct *, work )
> + __field( work_func_t, func )
> + ),
> +
> + TP_fast_assign(
> + memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
> + __entry->thread_pid = wq_thread->pid;
> + __entry->work = work;
> + __entry->func = work->func;
> + ),
> +
> + TP_printk("thread=%s:%d work=%p func=%p", __entry->thread_comm,
> + __entry->thread_pid, __entry->work, __entry->func)
> +);

please don't display raw kernel pointer.

work: unnecessary. it's internal information and func name provide enough
information.
func: %pF can print pritty format


> +
> +TRACE_EVENT(workqueue_execution,
> +
> + TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
> +
> + TP_ARGS(wq_thread, work),
> +
> + TP_STRUCT__entry(
> + __array( char, thread_comm, TASK_COMM_LEN )
> + __field( pid_t, thread_pid )
> + __field( struct work_struct *, work )
> + __field( work_func_t, func )
> + ),
> +
> + TP_fast_assign(
> + memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
> + __entry->thread_pid = wq_thread->pid;
> + __entry->work = work;
> + __entry->func = work->func;
> + ),
> +
> + TP_printk("thread=%s:%d work=%p func=%p", __entry->thread_comm,
> + __entry->thread_pid, __entry->work, __entry->func)
> +);

ditto.

and, I plan to rename this tracepoint to workqueue_handler_entry()
and create workqueue_handler_exit().

It's because stupid driver comsume many cputime in workqueue thread,
it make delay to after work. We need mesure it.


> +
> +/* Trace the creation of one workqueue thread on a cpu */
> +TRACE_EVENT(workqueue_creation,
> +
> + TP_PROTO(struct task_struct *wq_thread, int cpu),
> +
> + TP_ARGS(wq_thread, cpu),
> +
> + TP_STRUCT__entry(
> + __array( char, thread_comm, TASK_COMM_LEN )
> + __field( pid_t, thread_pid )
> + __field( int, cpu )
> + ),
> +
> + TP_fast_assign(
> + memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
> + __entry->thread_pid = wq_thread->pid;
> + __entry->cpu = cpu;
> + ),
> +
> + TP_printk("thread=%s:%d cpu=%d", __entry->thread_comm,
> + __entry->thread_pid, __entry->cpu)
> +);
> +
> +TRACE_EVENT(workqueue_destruction,
> +
> + TP_PROTO(struct task_struct *wq_thread),
> +
> + TP_ARGS(wq_thread),
> +
> + TP_STRUCT__entry(
> + __array( char, thread_comm, TASK_COMM_LEN )
> + __field( pid_t, thread_pid )
> + ),
> +
> + TP_fast_assign(
> + memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
> + __entry->thread_pid = wq_thread->pid;
> + ),
> +
> + TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid)
> +);
> +
> +#undef TRACE_SYSTEM
> --
> 1.5.5.3
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/