Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef BENCH_H
0003 #define BENCH_H
0004 
0005 #include <sys/time.h>
0006 
0007 extern struct timeval bench__start, bench__end, bench__runtime;
0008 
0009 /*
0010  * The madvise transparent hugepage constants were added in glibc
0011  * 2.13. For compatibility with older versions of glibc, define these
0012  * tokens if they are not already defined.
0013  *
0014  * PA-RISC uses different madvise values from other architectures and
0015  * needs to be special-cased.
0016  */
0017 #ifdef __hppa__
0018 # ifndef MADV_HUGEPAGE
0019 #  define MADV_HUGEPAGE     67
0020 # endif
0021 # ifndef MADV_NOHUGEPAGE
0022 #  define MADV_NOHUGEPAGE   68
0023 # endif
0024 #else
0025 # ifndef MADV_HUGEPAGE
0026 #  define MADV_HUGEPAGE     14
0027 # endif
0028 # ifndef MADV_NOHUGEPAGE
0029 #  define MADV_NOHUGEPAGE   15
0030 # endif
0031 #endif
0032 
0033 int bench_numa(int argc, const char **argv);
0034 int bench_sched_messaging(int argc, const char **argv);
0035 int bench_sched_pipe(int argc, const char **argv);
0036 int bench_syscall_basic(int argc, const char **argv);
0037 int bench_mem_memcpy(int argc, const char **argv);
0038 int bench_mem_memset(int argc, const char **argv);
0039 int bench_mem_find_bit(int argc, const char **argv);
0040 int bench_futex_hash(int argc, const char **argv);
0041 int bench_futex_wake(int argc, const char **argv);
0042 int bench_futex_wake_parallel(int argc, const char **argv);
0043 int bench_futex_requeue(int argc, const char **argv);
0044 /* pi futexes */
0045 int bench_futex_lock_pi(int argc, const char **argv);
0046 int bench_epoll_wait(int argc, const char **argv);
0047 int bench_epoll_ctl(int argc, const char **argv);
0048 int bench_synthesize(int argc, const char **argv);
0049 int bench_kallsyms_parse(int argc, const char **argv);
0050 int bench_inject_build_id(int argc, const char **argv);
0051 int bench_evlist_open_close(int argc, const char **argv);
0052 int bench_breakpoint_thread(int argc, const char **argv);
0053 int bench_breakpoint_enable(int argc, const char **argv);
0054 
0055 #define BENCH_FORMAT_DEFAULT_STR    "default"
0056 #define BENCH_FORMAT_DEFAULT        0
0057 #define BENCH_FORMAT_SIMPLE_STR     "simple"
0058 #define BENCH_FORMAT_SIMPLE     1
0059 
0060 #define BENCH_FORMAT_UNKNOWN        -1
0061 
0062 extern int bench_format;
0063 extern unsigned int bench_repeat;
0064 
0065 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
0066 #include <pthread.h>
0067 #include <linux/compiler.h>
0068 static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
0069                           size_t cpusetsize __maybe_unused,
0070                           cpu_set_t *cpuset __maybe_unused)
0071 {
0072     return 0;
0073 }
0074 #endif
0075 
0076 #endif