Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <stdint.h>
0003 #include <time.h>
0004 
0005 /*
0006  * '18446744073709551615\0'
0007  */
0008 #define BUFF_U64_STR_SIZE   24
0009 #define MAX_PATH        1024
0010 
0011 #define container_of(ptr, type, member)({           \
0012     const typeof(((type *)0)->member) *__mptr = (ptr);  \
0013     (type *)((char *)__mptr - offsetof(type, member)) ; })
0014 
0015 extern int config_debug;
0016 void debug_msg(const char *fmt, ...);
0017 void err_msg(const char *fmt, ...);
0018 
0019 long parse_seconds_duration(char *val);
0020 void get_duration(time_t start_time, char *output, int output_size);
0021 
0022 int parse_cpu_list(char *cpu_list, char **monitored_cpus);
0023 long long get_llong_from_str(char *start);
0024 
0025 static inline void
0026 update_min(unsigned long long *a, unsigned long long *b)
0027 {
0028     if (*a > *b)
0029         *a = *b;
0030 }
0031 
0032 static inline void
0033 update_max(unsigned long long *a, unsigned long long *b)
0034 {
0035     if (*a < *b)
0036         *a = *b;
0037 }
0038 
0039 static inline void
0040 update_sum(unsigned long long *a, unsigned long long *b)
0041 {
0042     *a += *b;
0043 }
0044 
0045 struct sched_attr {
0046     uint32_t size;
0047     uint32_t sched_policy;
0048     uint64_t sched_flags;
0049     int32_t sched_nice;
0050     uint32_t sched_priority;
0051     uint64_t sched_runtime;
0052     uint64_t sched_deadline;
0053     uint64_t sched_period;
0054 };
0055 
0056 int parse_prio(char *arg, struct sched_attr *sched_param);
0057 int set_comm_sched_attr(const char *comm_prefix, struct sched_attr *attr);
0058 int set_cpu_dma_latency(int32_t latency);