Date: Mon, 17 Oct 2005 16:42:24 -0400 From: Jung-uk Kim <jkim@FreeBSD.org> To: John Baldwin <jhb@FreeBSD.org> Cc: cvs-src@FreeBSD.org, Eric Anholt <eta@lclark.edu>, cvs-all@FreeBSD.org, obrien@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/amd64/amd64 identcpu.c src/sys/i386/i386 identcpu.c Message-ID: <200510171642.26719.jkim@FreeBSD.org> In-Reply-To: <200510171554.46682.jhb@freebsd.org> References: <200510160858.j9G8wR9v045670@repoman.freebsd.org> <1129576130.1152.30.camel@leguin> <200510171554.46682.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_yyAVDEJ8WWt8p2+
Content-Type: text/plain;
charset="euc-kr"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Monday 17 October 2005 03:54 pm, John Baldwin wrote:
> Doing it for each CPU would really bloat the output, and in
> practice I don't think would buy us anything. Note that the code
> assumes the package topology is uniform as well, not just the
> printfs. :)
:-)
> Probably the messages could be made less ambiguous by splitting it
> into two lines that say something like:
> Cores per package: 2
> Logical CPUs per core: 1
>
> Except that each line would only print if it's value was greater
> than 1. Thus, on David's box you would get:
> Cores per package: 2
>
> On a PIV with HTT would get:
> Logical CPUs per core: 2
>
> And on the super-spiffy Zueeglecorp CPU, you would get:
> Cores per package: 4
> Logical CPUs per core: 4
The patch is attached. Please review.
Thanks for the suggestions and no thanks for bikeshed,
Jung-uk Kim
--Boundary-00=_yyAVDEJ8WWt8p2+
Content-Type: text/x-diff;
charset="euc-kr";
name="identcpu.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="identcpu.diff"
Index: sys/amd64/amd64/identcpu.c
===================================================================
RCS file: /home/ncvs/src/sys/amd64/amd64/identcpu.c,v
retrieving revision 1.139
diff -u -r1.139 identcpu.c
--- sys/amd64/amd64/identcpu.c 17 Oct 2005 15:51:27 -0000 1.139
+++ sys/amd64/amd64/identcpu.c 17 Oct 2005 20:37:01 -0000
@@ -358,9 +358,10 @@
cmp = ((regs[0] & 0xfc000000) >> 26) + 1;
}
if (cmp > 1)
- printf("\n Physical cores: %d", cmp);
- if (htt > 1)
- printf("\n Logical cores: %d", htt);
+ printf("\n Cores per package: %d", cmp);
+ if ((htt / cmp) > 1)
+ printf("\n Logical CPUs per core: %d",
+ htt / cmp);
}
}
/* Avoid ugly blank lines: only print newline when we have to. */
Index: sys/i386/i386/identcpu.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/identcpu.c,v
retrieving revision 1.148
diff -u -r1.148 identcpu.c
--- sys/i386/i386/identcpu.c 17 Oct 2005 15:51:28 -0000 1.148
+++ sys/i386/i386/identcpu.c 17 Oct 2005 20:37:01 -0000
@@ -848,9 +848,10 @@
cmp = ((regs[0] & 0xfc000000) >> 26) + 1;
}
if (cmp > 1)
- printf("\n Physical cores: %d", cmp);
- if (htt > 1)
- printf("\n Logical cores: %d", htt);
+ printf("\n Cores per package: %d", cmp);
+ if ((htt / cmp) > 1)
+ printf("\n Logical CPUs per core: %d",
+ htt / cmp);
}
} else if (strcmp(cpu_vendor, "CyrixInstead") == 0) {
printf(" DIR=0x%04x", cyrix_did);
--Boundary-00=_yyAVDEJ8WWt8p2+--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510171642.26719.jkim>
