Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 250887 - New package: cleanbench - the clean nbench Benchmark utility for Linux/UNIX
Summary: New package: cleanbench - the clean nbench Benchmark utility for Linux/UNIX
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Default Assignee for New Packages
URL: http://mattst88.com/programming/clean...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-14 03:10 UTC by Matt Turner
Modified: 2014-07-19 03:00 UTC (History)
2 users (show)

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


Attachments
cleanbench-1.0 ebuild (cleanbench-1.0.ebuild,896 bytes, text/plain)
2008-12-14 03:10 UTC, Matt Turner
Details
fixed cleanbench 1.0 ebuild (cleanbench-1.0.ebuild,874 bytes, text/plain)
2008-12-14 18:55 UTC, Matt Turner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Turner gentoo-dev 2008-12-14 03:10:19 UTC
app-benchmarks/nbench, a commonly used benchmark utility has some of the worst code in existence. Revolting in many cases.

nbench is virtually dead upstream. Also since it has to stay compatible with previous versions it includes nastiness like DOS specific code, so I decided to fork it and create cleanbench. cleanbench should be portable to platforms with sane ANSI C compilers.

cleanbench is nbench with major cleaning, reformatting, and all around making it
decent code. Specifically, this entails 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%)

cleanbench is a 40% reduction in SLOC over nbench!

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

There's more to do and to clean, but it's at a good initial state.

Please import into portage.

[*] bug 137043
Comment 1 Matt Turner gentoo-dev 2008-12-14 03:10:40 UTC
Created attachment 175236 [details]
cleanbench-1.0 ebuild
Comment 2 Serkan Kaba (RETIRED) gentoo-dev 2008-12-14 06:25:04 UTC
Doesn't the makefile override what you pass for CC and CFLAGS and LINKFLAGS is never used in the makefile. Also please use emake instead of make.

Thanks.
Serkan
Comment 3 Matt Turner gentoo-dev 2008-12-14 18:55:51 UTC
Created attachment 175269 [details]
fixed cleanbench 1.0 ebuild

I believe this ebuild fixes the things mentioned previously. Please review.
Comment 4 Serkan Kaba (RETIRED) gentoo-dev 2008-12-16 08:06:14 UTC
(In reply to comment #3)
> Created an attachment (id=175269) [edit]
> fixed cleanbench 1.0 ebuild
> 
> I believe this ebuild fixes the things mentioned previously. Please review.
> 

What I meant was the package's Makefile overrides the enviroments CFLAGS,CC and doesn't respect LDFLAGS. So, cleanbench's Makefile needs to be fixed actually. Flameeyes' article[1] has a part explaining it. 

1: http://lwn.net/Articles/277132/

@Flameeyes: Adding you for suggestions. Thanks.
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-12-19 13:42:48 UTC
The sed should be in src_unpack (or prepare for EAPI=2), dobin and doins should be checked with || die in case of failure.

As for the Makefile, since there is a cleanbench.o object listed, you can just replace LIBS with LDLIBS and replace the rule

all: $(OBJS)

with

all: cleanbench

cleanbench: $(OBJS)

and it will respect LDFLAGS and build properly; but it would require changes to other parts of the makefile to work properly anyway: the .c -> .o transformation can be made much shorter, by using something like

OPTFLAGS ?= -march= ...
override CFLAGS = $(OPTFLAGS) $(WARN)

and then removing all the rules.

sysinfo.sh is a bit of a problem, but that's beside the point I guess.