Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include "trace.h"
0003 
0004 /*
0005  * osnoise_context - read, store, write, restore osnoise configs.
0006  */
0007 struct osnoise_context {
0008     int         flags;
0009     int         ref;
0010 
0011     char            *curr_cpus;
0012     char            *orig_cpus;
0013 
0014     /* 0 as init value */
0015     unsigned long long  orig_runtime_us;
0016     unsigned long long  runtime_us;
0017 
0018     /* 0 as init value */
0019     unsigned long long  orig_period_us;
0020     unsigned long long  period_us;
0021 
0022     /* 0 as init value */
0023     long long       orig_timerlat_period_us;
0024     long long       timerlat_period_us;
0025 
0026     /* 0 as init value */
0027     long long       orig_tracing_thresh;
0028     long long       tracing_thresh;
0029 
0030     /* -1 as init value because 0 is disabled */
0031     long long       orig_stop_us;
0032     long long       stop_us;
0033 
0034     /* -1 as init value because 0 is disabled */
0035     long long       orig_stop_total_us;
0036     long long       stop_total_us;
0037 
0038     /* -1 as init value because 0 is disabled */
0039     long long       orig_print_stack;
0040     long long       print_stack;
0041 };
0042 
0043 /*
0044  * *_INIT_VALs are also invalid values, they are used to
0045  * communicate errors.
0046  */
0047 #define OSNOISE_OPTION_INIT_VAL (-1)
0048 #define OSNOISE_TIME_INIT_VAL   (0)
0049 
0050 struct osnoise_context *osnoise_context_alloc(void);
0051 int osnoise_get_context(struct osnoise_context *context);
0052 void osnoise_put_context(struct osnoise_context *context);
0053 
0054 int osnoise_set_cpus(struct osnoise_context *context, char *cpus);
0055 void osnoise_restore_cpus(struct osnoise_context *context);
0056 
0057 int osnoise_set_runtime_period(struct osnoise_context *context,
0058                    unsigned long long runtime,
0059                    unsigned long long period);
0060 void osnoise_restore_runtime_period(struct osnoise_context *context);
0061 
0062 int osnoise_set_stop_us(struct osnoise_context *context,
0063             long long stop_us);
0064 void osnoise_restore_stop_us(struct osnoise_context *context);
0065 
0066 int osnoise_set_stop_total_us(struct osnoise_context *context,
0067                   long long stop_total_us);
0068 void osnoise_restore_stop_total_us(struct osnoise_context *context);
0069 
0070 int osnoise_set_timerlat_period_us(struct osnoise_context *context,
0071                    long long timerlat_period_us);
0072 void osnoise_restore_timerlat_period_us(struct osnoise_context *context);
0073 
0074 int osnoise_set_tracing_thresh(struct osnoise_context *context,
0075                    long long tracing_thresh);
0076 void osnoise_restore_tracing_thresh(struct osnoise_context *context);
0077 
0078 void osnoise_restore_print_stack(struct osnoise_context *context);
0079 int osnoise_set_print_stack(struct osnoise_context *context,
0080                 long long print_stack);
0081 
0082 /*
0083  * osnoise_tool -  osnoise based tool definition.
0084  */
0085 struct osnoise_tool {
0086     struct trace_instance       trace;
0087     struct osnoise_context      *context;
0088     void                *data;
0089     void                *params;
0090     time_t              start_time;
0091 };
0092 
0093 void osnoise_destroy_tool(struct osnoise_tool *top);
0094 struct osnoise_tool *osnoise_init_tool(char *tool_name);
0095 struct osnoise_tool *osnoise_init_trace_tool(char *tracer);
0096 
0097 int osnoise_hist_main(int argc, char *argv[]);
0098 int osnoise_top_main(int argc, char **argv);
0099 int osnoise_main(int argc, char **argv);