summaryrefslogtreecommitdiff
path: root/bench/syscall.c
blob: c14e1dc25e08aca773ca6bb2c2cb09e334cb80f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <time.h>
#include <sys/time.h>
#include <asm/unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include "../x86info.h"

void time_int80h()
{
	int i, ret;
	unsigned long start, end;

	if (show_bench != 1)
		return;

	start = rdtsc();
	for (i = 0; i < 1000000; i++) {
		asm volatile("call 0xfffff000"
			:"=a" (ret)
			:"0" (__NR_getppid));
	}
	end = rdtsc();
	printf("%f cycles\n", (end - start) / 1000000.0);
}