summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2009-12-11 00:32:31 -0500
committerDave Jones <davej@redhat.com>2009-12-11 00:32:31 -0500
commit99c162a97904043844131092b13d2007bcffa14e (patch)
tree70afb54c18f17ce0bee5f3f8d549fba065429a6e
parent7102fe88a1c35a20328d953155c8188e98b8d372 (diff)
Only calculate MHz on the first cpu, unless --all-cpus is passed.
-rw-r--r--bench/MHz.c7
-rw-r--r--x86info.c10
-rw-r--r--x86info.h4
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) {
diff --git a/x86info.c b/x86info.c
index 8b913bd..b2f469e 100644
--- a/x86info.c
+++ b/x86info.c
@@ -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));
diff --git a/x86info.h b/x86info.h
index 3f0a52f..4fea275 100644
--- a/x86info.h
+++ b/x86info.h
@@ -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;