1 /* 2 * Copyright (c) 2018 Google, Inc. 3 * 4 * SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef _LTP_EAS_UTIL_H_ 8 #define _LTP_EAS_UTIL_H_ 9 10 #include <linux/unistd.h> 11 #include <sched.h> 12 #include <stdio.h> 13 14 #define USEC_PER_SEC 1000000 15 16 #define TS_TO_USEC(x) (x.usec + x.sec * USEC_PER_SEC) 17 18 #ifndef SCHED_DEADLINE 19 #define SCHED_DEADLINE 6 20 #endif 21 22 #define gettid() syscall(__NR_gettid) 23 24 #define ERROR_CHECK(x) \ 25 if (x) \ 26 fprintf(stderr, "Error at line %d", __LINE__); 27 28 void affine(int cpu); 29 void burn(unsigned int usec, int sleep); 30 int find_cpus_with_capacity(int minmax, cpu_set_t * cpuset); 31 32 #endif /* _LTP_EAS_UTIL_H_ */ 33