syscall.c (3fe91f32620f658adfc073f9df831e7b82498575) syscall.c (391f84e5555c20a5b5ca4a2b0c3daec383765a09)
1/*
2 *
3 * syscall.c
4 *
5 * syscall: Benchmark for system call performance
6 */
7#include "../perf.h"
8#include "../util/util.h"

--- 32 unchanged lines hidden (view full) ---

41
42 gettimeofday(&start, NULL);
43
44 for (i = 0; i < loops; i++) {
45 switch (syscall) {
46 case __NR_getppid:
47 getppid();
48 break;
1/*
2 *
3 * syscall.c
4 *
5 * syscall: Benchmark for system call performance
6 */
7#include "../perf.h"
8#include "../util/util.h"

--- 32 unchanged lines hidden (view full) ---

41
42 gettimeofday(&start, NULL);
43
44 for (i = 0; i < loops; i++) {
45 switch (syscall) {
46 case __NR_getppid:
47 getppid();
48 break;
49 case __NR_getpgid:
50 getpgid(0);
51 break;
49 default:
50 break;
51 }
52 }
53
54 gettimeofday(&stop, NULL);
55 timersub(&stop, &start, &diff);
56
57 switch (syscall) {
58 case __NR_getppid:
59 name = "getppid()";
60 break;
52 default:
53 break;
54 }
55 }
56
57 gettimeofday(&stop, NULL);
58 timersub(&stop, &start, &diff);
59
60 switch (syscall) {
61 case __NR_getppid:
62 name = "getppid()";
63 break;
64 case __NR_getpgid:
65 name = "getpgid()";
66 break;
61 default:
62 break;
63 }
64
65 switch (bench_format) {
66 case BENCH_FORMAT_DEFAULT:
67 printf("# Executed %'d %s calls\n", loops, name);
68

--- 26 unchanged lines hidden (view full) ---

95
96 return 0;
97}
98
99int bench_syscall_basic(int argc, const char **argv)
100{
101 return bench_syscall_common(argc, argv, __NR_getppid);
102}
67 default:
68 break;
69 }
70
71 switch (bench_format) {
72 case BENCH_FORMAT_DEFAULT:
73 printf("# Executed %'d %s calls\n", loops, name);
74

--- 26 unchanged lines hidden (view full) ---

101
102 return 0;
103}
104
105int bench_syscall_basic(int argc, const char **argv)
106{
107 return bench_syscall_common(argc, argv, __NR_getppid);
108}
109
110int bench_syscall_getpgid(int argc, const char **argv)
111{
112 return bench_syscall_common(argc, argv, __NR_getpgid);
113}