Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (106 commits) perf kvm: Fix copy & paste error in description perf script: Kill script_spec__delete perf top: Fix a memory leak perf stat: Introduce get_ratio_color() helper perf session: Remove impossible condition check perf tools: Fix feature-bits rework fallout, remove unused variable perf script: Add generic perl handler to process events perf tools: Use for_each_set_bit() to iterate over feature flags perf tools: Unify handling of features when writing feature section perf report: Accept fifos as input file perf tools: Moving code in some files perf tools: Fix out-of-bound access to struct perf_session perf tools: Continue processing header on unknown features perf tools: Improve macros for struct feature_ops perf: builtin-record: Document and check that mmap_pages must be a power of two. perf: builtin-record: Provide advice if mmap'ing fails with EPERM. perf tools: Fix truncated annotation perf script: look up thread using tid instead of pid perf tools: Look up thread names for system wide profiling perf tools: Fix comm for processes with named threads ...
This commit is contained in:
@@ -338,7 +338,8 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
|
||||
/* trace_flags holds trace_options default values */
|
||||
unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
|
||||
TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME |
|
||||
TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE;
|
||||
TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |
|
||||
TRACE_ITER_IRQ_INFO;
|
||||
|
||||
static int trace_stop_count;
|
||||
static DEFINE_RAW_SPINLOCK(tracing_start_lock);
|
||||
@@ -426,6 +427,7 @@ static const char *trace_options[] = {
|
||||
"record-cmd",
|
||||
"overwrite",
|
||||
"disable_on_free",
|
||||
"irq-info",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -1843,6 +1845,33 @@ static void s_stop(struct seq_file *m, void *p)
|
||||
trace_event_read_unlock();
|
||||
}
|
||||
|
||||
static void
|
||||
get_total_entries(struct trace_array *tr, unsigned long *total, unsigned long *entries)
|
||||
{
|
||||
unsigned long count;
|
||||
int cpu;
|
||||
|
||||
*total = 0;
|
||||
*entries = 0;
|
||||
|
||||
for_each_tracing_cpu(cpu) {
|
||||
count = ring_buffer_entries_cpu(tr->buffer, cpu);
|
||||
/*
|
||||
* If this buffer has skipped entries, then we hold all
|
||||
* entries for the trace and we need to ignore the
|
||||
* ones before the time stamp.
|
||||
*/
|
||||
if (tr->data[cpu]->skipped_entries) {
|
||||
count -= tr->data[cpu]->skipped_entries;
|
||||
/* total is the same as the entries */
|
||||
*total += count;
|
||||
} else
|
||||
*total += count +
|
||||
ring_buffer_overrun_cpu(tr->buffer, cpu);
|
||||
*entries += count;
|
||||
}
|
||||
}
|
||||
|
||||
static void print_lat_help_header(struct seq_file *m)
|
||||
{
|
||||
seq_puts(m, "# _------=> CPU# \n");
|
||||
@@ -1855,12 +1884,35 @@ static void print_lat_help_header(struct seq_file *m)
|
||||
seq_puts(m, "# \\ / ||||| \\ | / \n");
|
||||
}
|
||||
|
||||
static void print_func_help_header(struct seq_file *m)
|
||||
static void print_event_info(struct trace_array *tr, struct seq_file *m)
|
||||
{
|
||||
seq_puts(m, "# TASK-PID CPU# TIMESTAMP FUNCTION\n");
|
||||
unsigned long total;
|
||||
unsigned long entries;
|
||||
|
||||
get_total_entries(tr, &total, &entries);
|
||||
seq_printf(m, "# entries-in-buffer/entries-written: %lu/%lu #P:%d\n",
|
||||
entries, total, num_online_cpus());
|
||||
seq_puts(m, "#\n");
|
||||
}
|
||||
|
||||
static void print_func_help_header(struct trace_array *tr, struct seq_file *m)
|
||||
{
|
||||
print_event_info(tr, m);
|
||||
seq_puts(m, "# TASK-PID CPU# TIMESTAMP FUNCTION\n");
|
||||
seq_puts(m, "# | | | | |\n");
|
||||
}
|
||||
|
||||
static void print_func_help_header_irq(struct trace_array *tr, struct seq_file *m)
|
||||
{
|
||||
print_event_info(tr, m);
|
||||
seq_puts(m, "# _-----=> irqs-off\n");
|
||||
seq_puts(m, "# / _----=> need-resched\n");
|
||||
seq_puts(m, "# | / _---=> hardirq/softirq\n");
|
||||
seq_puts(m, "# || / _--=> preempt-depth\n");
|
||||
seq_puts(m, "# ||| / delay\n");
|
||||
seq_puts(m, "# TASK-PID CPU# |||| TIMESTAMP FUNCTION\n");
|
||||
seq_puts(m, "# | | | |||| | |\n");
|
||||
}
|
||||
|
||||
void
|
||||
print_trace_header(struct seq_file *m, struct trace_iterator *iter)
|
||||
@@ -1869,32 +1921,14 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter)
|
||||
struct trace_array *tr = iter->tr;
|
||||
struct trace_array_cpu *data = tr->data[tr->cpu];
|
||||
struct tracer *type = current_trace;
|
||||
unsigned long entries = 0;
|
||||
unsigned long total = 0;
|
||||
unsigned long count;
|
||||
unsigned long entries;
|
||||
unsigned long total;
|
||||
const char *name = "preemption";
|
||||
int cpu;
|
||||
|
||||
if (type)
|
||||
name = type->name;
|
||||
|
||||
|
||||
for_each_tracing_cpu(cpu) {
|
||||
count = ring_buffer_entries_cpu(tr->buffer, cpu);
|
||||
/*
|
||||
* If this buffer has skipped entries, then we hold all
|
||||
* entries for the trace and we need to ignore the
|
||||
* ones before the time stamp.
|
||||
*/
|
||||
if (tr->data[cpu]->skipped_entries) {
|
||||
count -= tr->data[cpu]->skipped_entries;
|
||||
/* total is the same as the entries */
|
||||
total += count;
|
||||
} else
|
||||
total += count +
|
||||
ring_buffer_overrun_cpu(tr->buffer, cpu);
|
||||
entries += count;
|
||||
}
|
||||
get_total_entries(tr, &total, &entries);
|
||||
|
||||
seq_printf(m, "# %s latency trace v1.1.5 on %s\n",
|
||||
name, UTS_RELEASE);
|
||||
@@ -2140,6 +2174,21 @@ enum print_line_t print_trace_line(struct trace_iterator *iter)
|
||||
return print_trace_fmt(iter);
|
||||
}
|
||||
|
||||
void trace_latency_header(struct seq_file *m)
|
||||
{
|
||||
struct trace_iterator *iter = m->private;
|
||||
|
||||
/* print nothing if the buffers are empty */
|
||||
if (trace_empty(iter))
|
||||
return;
|
||||
|
||||
if (iter->iter_flags & TRACE_FILE_LAT_FMT)
|
||||
print_trace_header(m, iter);
|
||||
|
||||
if (!(trace_flags & TRACE_ITER_VERBOSE))
|
||||
print_lat_help_header(m);
|
||||
}
|
||||
|
||||
void trace_default_header(struct seq_file *m)
|
||||
{
|
||||
struct trace_iterator *iter = m->private;
|
||||
@@ -2155,8 +2204,12 @@ void trace_default_header(struct seq_file *m)
|
||||
if (!(trace_flags & TRACE_ITER_VERBOSE))
|
||||
print_lat_help_header(m);
|
||||
} else {
|
||||
if (!(trace_flags & TRACE_ITER_VERBOSE))
|
||||
print_func_help_header(m);
|
||||
if (!(trace_flags & TRACE_ITER_VERBOSE)) {
|
||||
if (trace_flags & TRACE_ITER_IRQ_INFO)
|
||||
print_func_help_header_irq(iter->tr, m);
|
||||
else
|
||||
print_func_help_header(iter->tr, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -370,6 +370,7 @@ void trace_graph_function(struct trace_array *tr,
|
||||
unsigned long ip,
|
||||
unsigned long parent_ip,
|
||||
unsigned long flags, int pc);
|
||||
void trace_latency_header(struct seq_file *m);
|
||||
void trace_default_header(struct seq_file *m);
|
||||
void print_trace_header(struct seq_file *m, struct trace_iterator *iter);
|
||||
int trace_empty(struct trace_iterator *iter);
|
||||
@@ -654,6 +655,7 @@ enum trace_iterator_flags {
|
||||
TRACE_ITER_RECORD_CMD = 0x100000,
|
||||
TRACE_ITER_OVERWRITE = 0x200000,
|
||||
TRACE_ITER_STOP_ON_FREE = 0x400000,
|
||||
TRACE_ITER_IRQ_INFO = 0x800000,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -27,6 +27,12 @@
|
||||
#include "trace.h"
|
||||
#include "trace_output.h"
|
||||
|
||||
#define DEFAULT_SYS_FILTER_MESSAGE \
|
||||
"### global filter ###\n" \
|
||||
"# Use this to set filters for multiple events.\n" \
|
||||
"# Only events with the given fields will be affected.\n" \
|
||||
"# If no events are modified, an error message will be displayed here"
|
||||
|
||||
enum filter_op_ids
|
||||
{
|
||||
OP_OR,
|
||||
@@ -646,7 +652,7 @@ void print_subsystem_event_filter(struct event_subsystem *system,
|
||||
if (filter && filter->filter_string)
|
||||
trace_seq_printf(s, "%s\n", filter->filter_string);
|
||||
else
|
||||
trace_seq_printf(s, "none\n");
|
||||
trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
|
||||
mutex_unlock(&event_mutex);
|
||||
}
|
||||
|
||||
@@ -1838,7 +1844,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
|
||||
if (!filter)
|
||||
goto out;
|
||||
|
||||
replace_filter_string(filter, filter_string);
|
||||
/* System filters just show a default message */
|
||||
kfree(filter->filter_string);
|
||||
filter->filter_string = NULL;
|
||||
|
||||
/*
|
||||
* No event actually uses the system filter
|
||||
* we can free it without synchronize_sched().
|
||||
@@ -1848,14 +1857,12 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
|
||||
|
||||
parse_init(ps, filter_ops, filter_string);
|
||||
err = filter_parse(ps);
|
||||
if (err) {
|
||||
append_filter_err(ps, system->filter);
|
||||
goto out;
|
||||
}
|
||||
if (err)
|
||||
goto err_filter;
|
||||
|
||||
err = replace_system_preds(system, ps, filter_string);
|
||||
if (err)
|
||||
append_filter_err(ps, system->filter);
|
||||
goto err_filter;
|
||||
|
||||
out:
|
||||
filter_opstack_clear(ps);
|
||||
@@ -1865,6 +1872,11 @@ out_unlock:
|
||||
mutex_unlock(&event_mutex);
|
||||
|
||||
return err;
|
||||
|
||||
err_filter:
|
||||
replace_filter_string(filter, filter_string);
|
||||
append_filter_err(ps, system->filter);
|
||||
goto out;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PERF_EVENTS
|
||||
|
@@ -280,9 +280,20 @@ static enum print_line_t irqsoff_print_line(struct trace_iterator *iter)
|
||||
}
|
||||
|
||||
static void irqsoff_graph_return(struct ftrace_graph_ret *trace) { }
|
||||
static void irqsoff_print_header(struct seq_file *s) { }
|
||||
static void irqsoff_trace_open(struct trace_iterator *iter) { }
|
||||
static void irqsoff_trace_close(struct trace_iterator *iter) { }
|
||||
|
||||
#ifdef CONFIG_FUNCTION_TRACER
|
||||
static void irqsoff_print_header(struct seq_file *s)
|
||||
{
|
||||
trace_default_header(s);
|
||||
}
|
||||
#else
|
||||
static void irqsoff_print_header(struct seq_file *s)
|
||||
{
|
||||
trace_latency_header(s);
|
||||
}
|
||||
#endif /* CONFIG_FUNCTION_TRACER */
|
||||
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
|
||||
|
||||
/*
|
||||
|
@@ -627,11 +627,23 @@ int trace_print_context(struct trace_iterator *iter)
|
||||
unsigned long usec_rem = do_div(t, USEC_PER_SEC);
|
||||
unsigned long secs = (unsigned long)t;
|
||||
char comm[TASK_COMM_LEN];
|
||||
int ret;
|
||||
|
||||
trace_find_cmdline(entry->pid, comm);
|
||||
|
||||
return trace_seq_printf(s, "%16s-%-5d [%03d] %5lu.%06lu: ",
|
||||
comm, entry->pid, iter->cpu, secs, usec_rem);
|
||||
ret = trace_seq_printf(s, "%16s-%-5d [%03d] ",
|
||||
comm, entry->pid, iter->cpu);
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
if (trace_flags & TRACE_ITER_IRQ_INFO) {
|
||||
ret = trace_print_lat_fmt(s, entry);
|
||||
if (!ret)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return trace_seq_printf(s, " %5lu.%06lu: ",
|
||||
secs, usec_rem);
|
||||
}
|
||||
|
||||
int trace_print_lat_context(struct trace_iterator *iter)
|
||||
|
@@ -280,9 +280,20 @@ static enum print_line_t wakeup_print_line(struct trace_iterator *iter)
|
||||
}
|
||||
|
||||
static void wakeup_graph_return(struct ftrace_graph_ret *trace) { }
|
||||
static void wakeup_print_header(struct seq_file *s) { }
|
||||
static void wakeup_trace_open(struct trace_iterator *iter) { }
|
||||
static void wakeup_trace_close(struct trace_iterator *iter) { }
|
||||
|
||||
#ifdef CONFIG_FUNCTION_TRACER
|
||||
static void wakeup_print_header(struct seq_file *s)
|
||||
{
|
||||
trace_default_header(s);
|
||||
}
|
||||
#else
|
||||
static void wakeup_print_header(struct seq_file *s)
|
||||
{
|
||||
trace_latency_header(s);
|
||||
}
|
||||
#endif /* CONFIG_FUNCTION_TRACER */
|
||||
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user