@@ -338,7 +338,8 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
338338/* trace_flags holds trace_options default values */
339339unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
340340 TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME |
341- TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE ;
341+ TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |
342+ TRACE_ITER_IRQ_INFO ;
342343
343344static int trace_stop_count ;
344345static DEFINE_RAW_SPINLOCK (tracing_start_lock );
@@ -426,6 +427,7 @@ static const char *trace_options[] = {
426427 "record-cmd" ,
427428 "overwrite" ,
428429 "disable_on_free" ,
430+ "irq-info" ,
429431 NULL
430432};
431433
@@ -1843,6 +1845,33 @@ static void s_stop(struct seq_file *m, void *p)
18431845 trace_event_read_unlock ();
18441846}
18451847
1848+ static void
1849+ get_total_entries (struct trace_array * tr , unsigned long * total , unsigned long * entries )
1850+ {
1851+ unsigned long count ;
1852+ int cpu ;
1853+
1854+ * total = 0 ;
1855+ * entries = 0 ;
1856+
1857+ for_each_tracing_cpu (cpu ) {
1858+ count = ring_buffer_entries_cpu (tr -> buffer , cpu );
1859+ /*
1860+ * If this buffer has skipped entries, then we hold all
1861+ * entries for the trace and we need to ignore the
1862+ * ones before the time stamp.
1863+ */
1864+ if (tr -> data [cpu ]-> skipped_entries ) {
1865+ count -= tr -> data [cpu ]-> skipped_entries ;
1866+ /* total is the same as the entries */
1867+ * total += count ;
1868+ } else
1869+ * total += count +
1870+ ring_buffer_overrun_cpu (tr -> buffer , cpu );
1871+ * entries += count ;
1872+ }
1873+ }
1874+
18461875static void print_lat_help_header (struct seq_file * m )
18471876{
18481877 seq_puts (m , "# _------=> CPU# \n" );
@@ -1855,12 +1884,35 @@ static void print_lat_help_header(struct seq_file *m)
18551884 seq_puts (m , "# \\ / ||||| \\ | / \n" );
18561885}
18571886
1858- static void print_func_help_header ( struct seq_file * m )
1887+ static void print_event_info ( struct trace_array * tr , struct seq_file * m )
18591888{
1860- seq_puts (m , "# TASK-PID CPU# TIMESTAMP FUNCTION\n" );
1889+ unsigned long total ;
1890+ unsigned long entries ;
1891+
1892+ get_total_entries (tr , & total , & entries );
1893+ seq_printf (m , "# entries-in-buffer/entries-written: %lu/%lu #P:%d\n" ,
1894+ entries , total , num_online_cpus ());
1895+ seq_puts (m , "#\n" );
1896+ }
1897+
1898+ static void print_func_help_header (struct trace_array * tr , struct seq_file * m )
1899+ {
1900+ print_event_info (tr , m );
1901+ seq_puts (m , "# TASK-PID CPU# TIMESTAMP FUNCTION\n" );
18611902 seq_puts (m , "# | | | | |\n" );
18621903}
18631904
1905+ static void print_func_help_header_irq (struct trace_array * tr , struct seq_file * m )
1906+ {
1907+ print_event_info (tr , m );
1908+ seq_puts (m , "# _-----=> irqs-off\n" );
1909+ seq_puts (m , "# / _----=> need-resched\n" );
1910+ seq_puts (m , "# | / _---=> hardirq/softirq\n" );
1911+ seq_puts (m , "# || / _--=> preempt-depth\n" );
1912+ seq_puts (m , "# ||| / delay\n" );
1913+ seq_puts (m , "# TASK-PID CPU# |||| TIMESTAMP FUNCTION\n" );
1914+ seq_puts (m , "# | | | |||| | |\n" );
1915+ }
18641916
18651917void
18661918print_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)
18691921 struct trace_array * tr = iter -> tr ;
18701922 struct trace_array_cpu * data = tr -> data [tr -> cpu ];
18711923 struct tracer * type = current_trace ;
1872- unsigned long entries = 0 ;
1873- unsigned long total = 0 ;
1874- unsigned long count ;
1924+ unsigned long entries ;
1925+ unsigned long total ;
18751926 const char * name = "preemption" ;
1876- int cpu ;
18771927
18781928 if (type )
18791929 name = type -> name ;
18801930
1881-
1882- for_each_tracing_cpu (cpu ) {
1883- count = ring_buffer_entries_cpu (tr -> buffer , cpu );
1884- /*
1885- * If this buffer has skipped entries, then we hold all
1886- * entries for the trace and we need to ignore the
1887- * ones before the time stamp.
1888- */
1889- if (tr -> data [cpu ]-> skipped_entries ) {
1890- count -= tr -> data [cpu ]-> skipped_entries ;
1891- /* total is the same as the entries */
1892- total += count ;
1893- } else
1894- total += count +
1895- ring_buffer_overrun_cpu (tr -> buffer , cpu );
1896- entries += count ;
1897- }
1931+ get_total_entries (tr , & total , & entries );
18981932
18991933 seq_printf (m , "# %s latency trace v1.1.5 on %s\n" ,
19001934 name , UTS_RELEASE );
@@ -2170,8 +2204,12 @@ void trace_default_header(struct seq_file *m)
21702204 if (!(trace_flags & TRACE_ITER_VERBOSE ))
21712205 print_lat_help_header (m );
21722206 } else {
2173- if (!(trace_flags & TRACE_ITER_VERBOSE ))
2174- print_func_help_header (m );
2207+ if (!(trace_flags & TRACE_ITER_VERBOSE )) {
2208+ if (trace_flags & TRACE_ITER_IRQ_INFO )
2209+ print_func_help_header_irq (iter -> tr , m );
2210+ else
2211+ print_func_help_header (iter -> tr , m );
2212+ }
21752213 }
21762214}
21772215
0 commit comments