Skip to content

Commit

Permalink
Merge branch 'tracing/sysprof' into auto-ftrace-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Molnar committed Jul 10, 2008
2 parents 5373fdb + 37f5d73 commit ec1bb60
Show file tree
Hide file tree
Showing 6 changed files with 404 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kernel/trace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ config PREEMPT_TRACER
enabled. This option and the irqs-off timing option can be
used together or separately.)

config SYSPROF_TRACER
bool "Sysprof Tracer"
depends on X86
select TRACING
help
This tracer provides the trace needed by the 'Sysprof' userspace
tool.

config SCHED_TRACER
bool "Scheduling Latency Tracer"
depends on HAVE_FTRACE
Expand Down
1 change: 1 addition & 0 deletions kernel/trace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ obj-$(CONFIG_FTRACE) += libftrace.o

obj-$(CONFIG_TRACING) += trace.o
obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
obj-$(CONFIG_SYSPROF_TRACER) += trace_sysprof.o
obj-$(CONFIG_FTRACE) += trace_functions.o
obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o
obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o
Expand Down
3 changes: 3 additions & 0 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2913,6 +2913,9 @@ static __init void tracer_init_debugfs(void)
pr_warning("Could not create debugfs "
"'dyn_ftrace_total_info' entry\n");
#endif
#ifdef CONFIG_SYSPROF_TRACER
init_tracer_sysprof_debugfs(d_tracer);
#endif
}

static int trace_alloc_page(void)
Expand Down
6 changes: 6 additions & 0 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ struct trace_iterator {
void tracing_reset(struct trace_array_cpu *data);
int tracing_open_generic(struct inode *inode, struct file *filp);
struct dentry *tracing_init_dentry(void);
void init_tracer_sysprof_debugfs(struct dentry *d_tracer);

void ftrace(struct trace_array *tr,
struct trace_array_cpu *data,
unsigned long ip,
Expand Down Expand Up @@ -294,6 +296,10 @@ extern int trace_selftest_startup_wakeup(struct tracer *trace,
extern int trace_selftest_startup_sched_switch(struct tracer *trace,
struct trace_array *tr);
#endif
#ifdef CONFIG_SYSPROF_TRACER
extern int trace_selftest_startup_sysprof(struct tracer *trace,
struct trace_array *tr);
#endif
#endif /* CONFIG_FTRACE_STARTUP_TEST */

extern void *head_page(struct trace_array_cpu *data);
Expand Down
23 changes: 23 additions & 0 deletions kernel/trace/trace_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,26 @@ trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr
return ret;
}
#endif /* CONFIG_CONTEXT_SWITCH_TRACER */

#ifdef CONFIG_SYSPROF_TRACER
int
trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr)
{
unsigned long count;
int ret;

/* start the tracing */
tr->ctrl = 1;
trace->init(tr);
/* Sleep for a 1/10 of a second */
msleep(100);
/* stop the tracing. */
tr->ctrl = 0;
trace->ctrl_update(tr);
/* check the trace buffer */
ret = trace_test_buffer(tr, &count);
trace->reset(tr);

return ret;
}
#endif /* CONFIG_SYSPROF_TRACER */
Loading

0 comments on commit ec1bb60

Please sign in to comment.