diff options
author | davej <davej> | 2002-12-18 14:08:16 +0000 |
---|---|---|
committer | davej <davej> | 2002-12-18 14:08:16 +0000 |
commit | 1e96fae101618b176589dd4a3741b42b78bce33f (patch) | |
tree | b087b82f2b6737e7b74c68f181e0d306ec870270 | |
parent | 8200ec3ab061701ad504662490800549308faf87 (diff) |
split the int 0x80 and new sysenter stuff.
add --bench
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | bench/bench.h | 3 | ||||
-rw-r--r-- | bench/benchmarks.c | 6 | ||||
-rw-r--r-- | bench/int80h.c | 26 | ||||
-rw-r--r-- | bench/syscall.c | 18 | ||||
-rw-r--r-- | x86info.c | 15 | ||||
-rw-r--r-- | x86info.h | 2 |
7 files changed, 57 insertions, 15 deletions
@@ -45,6 +45,8 @@ OBJS =\ mtrr.o \ connector.o\ \ + bench/benchmarks.o\ + bench/int80h.o\ bench/MHz.o x86info: $(OBJS) diff --git a/bench/bench.h b/bench/bench.h new file mode 100644 index 0000000..1b48980 --- /dev/null +++ b/bench/bench.h @@ -0,0 +1,3 @@ +void time_int80h(void); + +#define rdtsc() ({ unsigned long a,d; asm volatile("rdtsc":"=a" (a), "=d" (d)); a; }) diff --git a/bench/benchmarks.c b/bench/benchmarks.c new file mode 100644 index 0000000..0ed251d --- /dev/null +++ b/bench/benchmarks.c @@ -0,0 +1,6 @@ +#include "bench.h" + +void show_benchmarks (void) +{ + time_int80h(); +} diff --git a/bench/int80h.c b/bench/int80h.c new file mode 100644 index 0000000..4e16933 --- /dev/null +++ b/bench/int80h.c @@ -0,0 +1,26 @@ +#include <time.h> +#include <sys/time.h> +#include <asm/unistd.h> +#include <sys/stat.h> +#include <stdio.h> +#include "../x86info.h" +#include "bench.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("int $0x80" + :"=a" (ret) + :"0" (__NR_getppid)); + } + end = rdtsc(); + printf("int 0x80 took %f cycles\n", (end - start) / 1000000.0); +} + diff --git a/bench/syscall.c b/bench/syscall.c index b271d70..c14e1dc 100644 --- a/bench/syscall.c +++ b/bench/syscall.c @@ -3,26 +3,19 @@ #include <asm/unistd.h> #include <sys/stat.h> #include <stdio.h> +#include "../x86info.h" -#define rdtsc() ({ unsigned long a,d; asm volatile("rdtsc":"=a" (a), "=d" (d)); a; }) - -int main() +void time_int80h() { int i, ret; unsigned long start, end; - 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); + if (show_bench != 1) + return; start = rdtsc(); for (i = 0; i < 1000000; i++) { - asm volatile("int $0x80" + asm volatile("call 0xfffff000" :"=a" (ret) :"0" (__NR_getppid)); } @@ -30,4 +23,3 @@ int main() printf("%f cycles\n", (end - start) / 1000000.0); } - @@ -1,5 +1,5 @@ /* - * $Id: x86info.c,v 1.71 2002/12/13 23:10:44 davej Exp $ + * $Id: x86info.c,v 1.72 2002/12/18 14:08:17 davej Exp $ * This file is part of x86info. * (C) 2001 Dave Jones. * @@ -27,7 +27,9 @@ #include "x86info.h" +int show_bench=0; int show_bluesmoke=0; +int show_bugs=0; int show_cacheinfo=0; int show_connector=0; int show_eblcr=0; @@ -38,7 +40,6 @@ int show_mtrr=0; int show_pm=0; int show_registers=0; int show_urls=0; -int show_bugs=0; static int show_mptable=0; static int show_MHz=0; @@ -55,6 +56,7 @@ void usage (char *programname) { printf ("Usage: %s [<switches>]\n\ -a, --all\n\ + --bench\n\ --bugs\n\ -c, --cache\n\ --connector\n\ @@ -80,6 +82,7 @@ static void parse_command_line (int argc, char **argv) for (argp = argv+1; argp <= argv + argc && (arg = *argp); argp++) { if ((!strcmp(arg, "-a") || !strcmp(arg, "--all"))) { + show_bench = 1; show_bluesmoke = 1; show_bugs = 1; show_cacheinfo = 1; @@ -97,6 +100,9 @@ static void parse_command_line (int argc, char **argv) need_root = 1; } + if (!strcmp(arg, "--bench")) + show_bench = 1; + if (!strcmp(arg, "--bugs")) show_bugs = 1; @@ -270,9 +276,14 @@ int main (int argc, char **argv) * Doing this per-cpu is a problem, as we can't * schedule userspace code per-cpu. * Although running nrCPUs * threads would probably work. + * + * Could also experiment with the new scheduler binding syscalls. */ if (show_MHz) estimate_MHz(i); + if (show_bench) + show_benchmarks(); + if (nrCPUs>1) separator(); @@ -105,7 +105,9 @@ void interpret_eblcr(u32 lo); int issmp(int *numcpu, int verb); void get_model_name (struct cpudata *cpu); void decode_connector (unsigned int type); +void show_benchmarks (void); +extern int show_bench; extern int show_bluesmoke; extern int show_bugs; extern int show_cacheinfo; |