diff options
author | Dave Jones <davej@redhat.com> | 2009-12-11 00:32:31 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2009-12-11 00:32:31 -0500 |
commit | 99c162a97904043844131092b13d2007bcffa14e (patch) | |
tree | 70afb54c18f17ce0bee5f3f8d549fba065429a6e | |
parent | 7102fe88a1c35a20328d953155c8188e98b8d372 (diff) |
Only calculate MHz on the first cpu, unless --all-cpus is passed.
-rw-r--r-- | bench/MHz.c | 7 | ||||
-rw-r--r-- | x86info.c | 10 | ||||
-rw-r--r-- | x86info.h | 4 |
3 files changed, 21 insertions, 0 deletions
diff --git a/bench/MHz.c b/bench/MHz.c index baf5215..53c11f1 100644 --- a/bench/MHz.c +++ b/bench/MHz.c @@ -28,6 +28,13 @@ void estimate_MHz(struct cpudata *cpu) unsigned int eax, ebx, ecx, edx; unsigned long r; + if (cpu->number != 0) { + if (all_cpus == 0) { + cpu->MHz = firstcpu->MHz; + return; + } + } + /* Make sure we have a TSC (and hence RDTSC) */ cpuid(cpu->number, 1, &eax, &ebx, &ecx, &edx); if ((edx & (1<<4)) == 0) { @@ -32,6 +32,8 @@ static int show_mptable=0; static int show_flags=0; static int show_MHz=0; +unsigned int all_cpus = 0; + static int num_sockets = 0; int debug = 0; @@ -44,10 +46,13 @@ static int need_root = 0; unsigned int nrCPUs=1; static unsigned int nrSMPCPUs; +struct cpudata *firstcpu; + static void usage (char *programname) { printf("Usage: %s [<switches>]\n\ -a, --all\n\ + --all-cpus\n\ --bench\n\ --bios\n\ --bugs\n\ @@ -95,6 +100,9 @@ static void parse_command_line (int argc, char **argv) need_root = 1; } + if (!strcmp(arg, "--all-cpus")) + all_cpus = 1; + if (!strcmp(arg, "--bench")) show_bench = 1; @@ -269,6 +277,8 @@ int main (int argc, char **argv) printf("Out of memory\n"); goto out; } + if (!firstcpu) + firstcpu = cpu; memset(cpu, 0, sizeof(struct cpudata)); @@ -185,6 +185,10 @@ extern int show_urls; extern unsigned int nrCPUs; +extern unsigned int all_cpus; + +extern struct cpudata *firstcpu; + extern int used_UP; extern int silent; extern int user_is_root; |