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