Commit 391f84e5 authored by Tiezhu Yang's avatar Tiezhu Yang Committed by Arnaldo Carvalho de Melo

perf bench syscall: Add getpgid syscall benchmark

This commit adds a simple getpgid syscall benchmark, more syscall
benchmarks can be added in the future.
Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/1668052208-14047-4-git-send-email-yangtiezhu@loongson.cnSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 3fe91f32
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#ifndef __NR_getppid #ifndef __NR_getppid
#define __NR_getppid 64 #define __NR_getppid 64
#endif #endif
#ifndef __NR_getpgid
#define __NR_getpgid 132
#endif
#ifndef __NR_gettid #ifndef __NR_gettid
#define __NR_gettid 224 #define __NR_gettid 224
#endif #endif
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
#ifndef __NR_getppid #ifndef __NR_getppid
#define __NR_getppid 110 #define __NR_getppid 110
#endif #endif
#ifndef __NR_getpgid
#define __NR_getpgid 121
#endif
#ifndef __NR_gettid #ifndef __NR_gettid
#define __NR_gettid 186 #define __NR_gettid 186
#endif #endif
......
...@@ -22,6 +22,7 @@ int bench_numa(int argc, const char **argv); ...@@ -22,6 +22,7 @@ int bench_numa(int argc, const char **argv);
int bench_sched_messaging(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_sched_pipe(int argc, const char **argv);
int bench_syscall_basic(int argc, const char **argv); int bench_syscall_basic(int argc, const char **argv);
int bench_syscall_getpgid(int argc, const char **argv);
int bench_mem_memcpy(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_memset(int argc, const char **argv);
int bench_mem_find_bit(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) ...@@ -46,6 +46,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall)
case __NR_getppid: case __NR_getppid:
getppid(); getppid();
break; break;
case __NR_getpgid:
getpgid(0);
break;
default: default:
break; break;
} }
...@@ -58,6 +61,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall) ...@@ -58,6 +61,9 @@ static int bench_syscall_common(int argc, const char **argv, int syscall)
case __NR_getppid: case __NR_getppid:
name = "getppid()"; name = "getppid()";
break; break;
case __NR_getpgid:
name = "getpgid()";
break;
default: default:
break; break;
} }
...@@ -100,3 +106,8 @@ int bench_syscall_basic(int argc, const char **argv) ...@@ -100,3 +106,8 @@ int bench_syscall_basic(int argc, const char **argv)
{ {
return bench_syscall_common(argc, argv, __NR_getppid); return bench_syscall_common(argc, argv, __NR_getppid);
} }
int bench_syscall_getpgid(int argc, const char **argv)
{
return bench_syscall_common(argc, argv, __NR_getpgid);
}
...@@ -52,6 +52,7 @@ static struct bench sched_benchmarks[] = { ...@@ -52,6 +52,7 @@ static struct bench sched_benchmarks[] = {
static struct bench syscall_benchmarks[] = { static struct bench syscall_benchmarks[] = {
{ "basic", "Benchmark for basic getppid(2) calls", bench_syscall_basic }, { "basic", "Benchmark for basic getppid(2) calls", bench_syscall_basic },
{ "getpgid", "Benchmark for getpgid(2) calls", bench_syscall_getpgid },
{ "all", "Run all syscall benchmarks", NULL }, { "all", "Run all syscall benchmarks", NULL },
{ NULL, NULL, NULL }, { NULL, NULL, NULL },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment