xref: /linux/tools/perf/bench/bench.h (revision 36ec807b627b4c0a0a382f0ae48eac7187d14b2b)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2c426bba0SHitoshi Mitake #ifndef BENCH_H
3c426bba0SHitoshi Mitake #define BENCH_H
4c426bba0SHitoshi Mitake 
5e4d9b04bSArnaldo Carvalho de Melo #include <sys/time.h>
6e4d9b04bSArnaldo Carvalho de Melo 
7e4d9b04bSArnaldo Carvalho de Melo extern struct timeval bench__start, bench__end, bench__runtime;
8e4d9b04bSArnaldo Carvalho de Melo 
9d1398ccfSVinson Lee /*
10d1398ccfSVinson Lee  * The madvise transparent hugepage constants were added in glibc
11d1398ccfSVinson Lee  * 2.13. For compatibility with older versions of glibc, define these
12d1398ccfSVinson Lee  * tokens if they are not already defined.
13d1398ccfSVinson Lee  */
14d1398ccfSVinson Lee # ifndef MADV_HUGEPAGE
15d1398ccfSVinson Lee #  define MADV_HUGEPAGE		14
16d1398ccfSVinson Lee # endif
17d1398ccfSVinson Lee # ifndef MADV_NOHUGEPAGE
18d1398ccfSVinson Lee #  define MADV_NOHUGEPAGE	15
19d1398ccfSVinson Lee # endif
20d1398ccfSVinson Lee 
21b0ad8ea6SArnaldo Carvalho de Melo int bench_numa(int argc, const char **argv);
22b0ad8ea6SArnaldo Carvalho de Melo int bench_sched_messaging(int argc, const char **argv);
23b0ad8ea6SArnaldo Carvalho de Melo int bench_sched_pipe(int argc, const char **argv);
247d5cb68aSAndrei Vagin int bench_sched_seccomp_notify(int argc, const char **argv);
25c2a08203SDavidlohr Bueso int bench_syscall_basic(int argc, const char **argv);
26391f84e5STiezhu Yang int bench_syscall_getpgid(int argc, const char **argv);
27ece7f7c0STiezhu Yang int bench_syscall_fork(int argc, const char **argv);
28540f8b56STiezhu Yang int bench_syscall_execve(int argc, const char **argv);
29b0ad8ea6SArnaldo Carvalho de Melo int bench_mem_memcpy(int argc, const char **argv);
30b0ad8ea6SArnaldo Carvalho de Melo int bench_mem_memset(int argc, const char **argv);
317c43b0c1SIan Rogers int bench_mem_find_bit(int argc, const char **argv);
32b0ad8ea6SArnaldo Carvalho de Melo int bench_futex_hash(int argc, const char **argv);
33b0ad8ea6SArnaldo Carvalho de Melo int bench_futex_wake(int argc, const char **argv);
34b0ad8ea6SArnaldo Carvalho de Melo int bench_futex_wake_parallel(int argc, const char **argv);
35b0ad8ea6SArnaldo Carvalho de Melo int bench_futex_requeue(int argc, const char **argv);
36d2f3f5d2SDavidlohr Bueso /* pi futexes */
37b0ad8ea6SArnaldo Carvalho de Melo int bench_futex_lock_pi(int argc, const char **argv);
38121dd9eaSDavidlohr Bueso int bench_epoll_wait(int argc, const char **argv);
39231457ecSDavidlohr Bueso int bench_epoll_ctl(int argc, const char **argv);
402a4b5166SIan Rogers int bench_synthesize(int argc, const char **argv);
4151876bd4SIan Rogers int bench_kallsyms_parse(int argc, const char **argv);
420bf02a0dSNamhyung Kim int bench_inject_build_id(int argc, const char **argv);
434241eabfSRiccardo Mancini int bench_evlist_open_close(int argc, const char **argv);
4468a6772fSDmitry Vyukov int bench_breakpoint_thread(int argc, const char **argv);
4568a6772fSDmitry Vyukov int bench_breakpoint_enable(int argc, const char **argv);
462df27071SArnaldo Carvalho de Melo int bench_uprobe_baseline(int argc, const char **argv);
476af5e4cfSArnaldo Carvalho de Melo int bench_uprobe_empty(int argc, const char **argv);
487b47623bSArnaldo Carvalho de Melo int bench_uprobe_trace_printk(int argc, const char **argv);
49*988052f4SIan Rogers int bench_uprobe_empty_ret(int argc, const char **argv);
50*988052f4SIan Rogers int bench_uprobe_trace_printk_ret(int argc, const char **argv);
51f6a7bbbfSNamhyung Kim int bench_pmu_scan(int argc, const char **argv);
52121dd9eaSDavidlohr Bueso 
53242aa14aSHitoshi Mitake #define BENCH_FORMAT_DEFAULT_STR	"default"
54242aa14aSHitoshi Mitake #define BENCH_FORMAT_DEFAULT		0
55242aa14aSHitoshi Mitake #define BENCH_FORMAT_SIMPLE_STR		"simple"
56242aa14aSHitoshi Mitake #define BENCH_FORMAT_SIMPLE		1
57242aa14aSHitoshi Mitake 
58242aa14aSHitoshi Mitake #define BENCH_FORMAT_UNKNOWN		-1
59242aa14aSHitoshi Mitake 
60242aa14aSHitoshi Mitake extern int bench_format;
61b6f0629aSDavidlohr Bueso extern unsigned int bench_repeat;
62242aa14aSHitoshi Mitake 
63d47d77c3SDavidlohr Bueso #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP
64d47d77c3SDavidlohr Bueso #include <pthread.h>
65d47d77c3SDavidlohr Bueso #include <linux/compiler.h>
66d47d77c3SDavidlohr Bueso static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused,
67d47d77c3SDavidlohr Bueso 					      size_t cpusetsize __maybe_unused,
68d47d77c3SDavidlohr Bueso 					      cpu_set_t *cpuset __maybe_unused)
69d47d77c3SDavidlohr Bueso {
70d47d77c3SDavidlohr Bueso 	return 0;
71d47d77c3SDavidlohr Bueso }
72d47d77c3SDavidlohr Bueso #endif
73d47d77c3SDavidlohr Bueso 
74c426bba0SHitoshi Mitake #endif
75