This commit adds a simple getpgrp syscall benchmark, more syscall
benchmarks can be added in the future.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
tools/arch/x86/include/uapi/asm/unistd_32.h | 3 +++
tools/arch/x86/include/uapi/asm/unistd_64.h | 3 +++
tools/perf/bench/bench.h | 1 +
tools/perf/bench/syscall.c | 11 +++++++++++
tools/perf/builtin-bench.c | 1 +
5 files changed, 19 insertions(+)
@@ -2,6 +2,9 @@
#ifndef __NR_getppid
#define __NR_getppid 64
#endif
+#ifndef __NR_getpgrp
+#define __NR_getpgrp 65
+#endif
#ifndef __NR_gettid
#define __NR_gettid 224
#endif
@@ -2,6 +2,9 @@
#ifndef __NR_getppid
#define __NR_getppid 110
#endif
+#ifndef __NR_getpgrp
+#define __NR_getpgrp 111
+#endif
#ifndef __NR_gettid
#define __NR_gettid 186
#endif
@@ -34,6 +34,7 @@ int bench_numa(int argc, const char **argv);
int bench_sched_messaging(int argc, const char **argv);
int bench_sched_pipe(int argc, const char **argv);
int bench_syscall_basic(int argc, const char **argv);
+int bench_syscall_getpgrp(int argc, const char **argv);
int bench_mem_memcpy(int argc, const char **argv);
int bench_mem_memset(int argc, const char **argv);
int bench_mem_find_bit(int argc, const char **argv);
@@ -46,6 +46,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall)
case __NR_getppid:
getppid();
break;
+ case __NR_getpgrp:
+ getpgrp();
+ break;
default:
break;
}
@@ -58,6 +61,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall)
case __NR_getppid:
name = "getppid()";
break;
+ case __NR_getpgrp:
+ name = "getpgrp()";
+ break;
default:
break;
}
@@ -100,3 +106,8 @@ int bench_syscall_basic(int argc, const char **argv)
{
return bench_syscall_common(argc, argv, __NR_getppid);
}
+
+int bench_syscall_getpgrp(int argc, const char **argv)
+{
+ return bench_syscall_common(argc, argv, __NR_getpgrp);
+}
@@ -52,6 +52,7 @@ static struct bench sched_benchmarks[] = {
static struct bench syscall_benchmarks[] = {
{ "basic", "Benchmark for basic getppid(2) calls", bench_syscall_basic },
+ { "getpgrp", "Benchmark for getpgrp(2) calls", bench_syscall_getpgrp },
{ "all", "Run all syscall benchmarks", NULL },
{ NULL, NULL, NULL },
};