Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #ifndef __TRACE_STAT_H
0003 #define __TRACE_STAT_H
0004 
0005 #include <linux/seq_file.h>
0006 
0007 /*
0008  * If you want to provide a stat file (one-shot statistics), fill
0009  * an iterator with stat_start/stat_next and a stat_show callbacks.
0010  * The others callbacks are optional.
0011  */
0012 struct tracer_stat {
0013     /* The name of your stat file */
0014     const char      *name;
0015     /* Iteration over statistic entries */
0016     void            *(*stat_start)(struct tracer_stat *trace);
0017     void            *(*stat_next)(void *prev, int idx);
0018     /* Compare two entries for stats sorting */
0019     cmp_func_t      stat_cmp;
0020     /* Print a stat entry */
0021     int         (*stat_show)(struct seq_file *s, void *p);
0022     /* Release an entry */
0023     void            (*stat_release)(void *stat);
0024     /* Print the headers of your stat entries */
0025     int         (*stat_headers)(struct seq_file *s);
0026 };
0027 
0028 /*
0029  * Destroy or create a stat file
0030  */
0031 extern int register_stat_tracer(struct tracer_stat *trace);
0032 extern void unregister_stat_tracer(struct tracer_stat *trace);
0033 
0034 #endif /* __TRACE_STAT_H */