Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 137043 - app-benchmarks/nbench-2.2.2 [PATCH] fix CPU detection on alpha
Summary: app-benchmarks/nbench-2.2.2 [PATCH] fix CPU detection on alpha
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Alpha Linux
: Normal minor (vote)
Assignee: Jeroen Roovers (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-16 17:20 UTC by Thomas Cort (RETIRED)
Modified: 2009-06-15 19:35 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
nbench-byte-2.2.2-alpha.patch (nbench-byte-2.2.2-alpha.patch,2.30 KB, patch)
2006-06-16 17:21 UTC, Thomas Cort (RETIRED)
Details | Diff
nbench-2.2.2-cpuinfo.patch (nbench-2.2.2-cpuinfo.patch,4.00 KB, patch)
2006-09-05 08:38 UTC, Thomas Cort (RETIRED)
Details | Diff
cleanbench-1.0 ebuild (cleanbench-1.0.ebuild,888 bytes, text/plain)
2008-12-12 20:40 UTC, Matt Turner
Details
cleanbench-1.0 sources (cleanbench-1.0.tar.bz2,62.25 KB, application/octet-stream)
2008-12-12 20:45 UTC, Matt Turner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Cort (RETIRED) gentoo-dev 2006-06-16 17:20:30 UTC
I'm going to attach a patch I wrote that fixes CPU and L2 Cache detection on alpha. CPU/cache detection is messed up on alpha because the format of /proc/cpuinfo is different for alpha. More details here: http://www.gentoo.org/proj/en/base/alpha/doc/alpha-porting-guide.xml#doc_chap7
I'll send a copy upstream, but I'm not sure if or when there will be another release. The last release was 12/30/04.

output without the patch:

/////////////////////////////////////////////////
CPU                 :
L2 Cache            :
/////////////////////////////////////////////////

output from 2 systems using the patch:

/////////////////////////////////////////////////
CPU                 : Dual Tsunami EV68AL 833MHz
L2 Cache            : 4096 KB
/////////////////////////////////////////////////
/////////////////////////////////////////////////
CPU                 : Miata EV56 433MHz
L2 Cache            : 96 KB
/////////////////////////////////////////////////

While you're at it, 'dodoc' reports that RESULT does not exist, but there is a file in the package called RESULTS. It looks like a typo, just add an S to RESULT in the dodoc line of the ebuild.
Comment 1 Thomas Cort (RETIRED) gentoo-dev 2006-06-16 17:21:16 UTC
Created attachment 89356 [details, diff]
nbench-byte-2.2.2-alpha.patch
Comment 2 SpanKY gentoo-dev 2006-06-17 01:28:51 UTC
Comment on attachment 89356 [details, diff]
nbench-byte-2.2.2-alpha.patch

patch is ugly, rewrite it better :p

also, this isnt broken on just alpha, but many other systems ... see the cpuinfo patch we apply to coreutils for the values on most all arches
Comment 3 Thomas Cort (RETIRED) gentoo-dev 2006-09-05 08:38:22 UTC
Created attachment 96077 [details, diff]
nbench-2.2.2-cpuinfo.patch

(In reply to comment #2)
> (From update of attachment 89356 [details, diff] [edit])
> patch is ugly, rewrite it better :p
> 
> also, this isnt broken on just alpha, but many other systems ... see the
> cpuinfo patch we apply to coreutils for the values on most all arches

Since reading /proc/cpuinfo is broken in a lot of programs for a lot of architectures, I wrote a library called libproccpuinfo which can read cpuinfo files from 19 architectures. Its in the portage tree as dev-libs/libproccpuinfo. Attached is a patch for nbench-2.2.2 which makes use of the library.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2008-10-29 05:40:17 UTC
Please check if 2.2.3 fixes the issue.
Comment 5 Matt Turner gentoo-dev 2008-12-12 20:39:16 UTC
No. The differences between 2.2.2 and 2.2.3 only consist of

--- nbench-byte-2.2.2/sysinfo.sh	2004-12-29 21:58:29.000000000 -0500
+++ nbench-byte-2.2.3/sysinfo.sh	2008-05-12 16:35:23.000000000 -0400
@@ -18,7 +18,8 @@
 
 compiler=`echo $* | sed -e 's/-static//g' -e 's/-Bstatic//g'`
 if $TEST `basename $1` = "gcc" && ($compiler -v) >/dev/null 2>&1 ; then
-    gccversion=`$compiler -v 2>&1 | sed -e "/version/!d"`
+# Cygwin writes more than one line with "version" in it
+    gccversion=`$compiler -v 2>&1 | sed -e "/version/!d" | tail -n 1`
 else
     gccversion="$1"
 fi

nbench not reading /proc/cpuinfo is a minor problem in comparison to the rotting hulk that is its code.

Since nbench has to stay compatible with previous versions which means supporting DOS and other nastiness, so I decided to fork it and create cleanbench.

I've spent some time majorly cleaning, reformatting, and all around making it decent code. Things like using libproccpuinfo, stripping huge amounts of entirely unused code, stripping DOS, Mac OS Classic, and Windows 3.1 support, fixing countless warnings, and splitting the 4445 line nbench1.c file into individual files for each benchmark. Check the code, you'd be amazed.

The benchmark results are exactly the same. No tests have been altered other than to clean code and remove cruft.

For comparison, sloccount reports

nbench-2.2.3
ansic:         5217 (98.94%)
sh:              56 (1.06%)

cleanbench-1.0
ansic:         3084 (98.28%)
sh:              54 (1.72%)

The sizes of binaries compiled with gcc-4.2.4 and CFLAGS="-O3 -march-k8 -msse3" are

nbench-2.2.3   - 64K
cleanbench-1.0 - 46K


ebuild attached. Please add to portage and mark bug as closed.
Comment 6 Matt Turner gentoo-dev 2008-12-12 20:40:35 UTC
Created attachment 175140 [details]
cleanbench-1.0 ebuild
Comment 7 Matt Turner gentoo-dev 2008-12-12 20:45:58 UTC
Created attachment 175141 [details]
cleanbench-1.0 sources
Comment 8 Tobias Klausmann (RETIRED) gentoo-dev 2009-06-15 19:35:12 UTC
Since nothing is happening here anymore, I'll mark this closed/wontfix.