------------------------------------------------------------------------------------------------------------------
sys_basher	Rev 2.0.1, Copyright 2006-2014 Polybus Systems Corp
------------------------------------------------------------------------------------------------------------------
sys_basher is offered free of charge under a BSD license (see COPYRIGHT file). There is no warranty either expressed
or implied.

It was written by Joshua Rosen of Polybus Systems Corp.

Any questions should be sent to bjrosen@polybus.com.

http://www.polybus.com

------------------------------------------------------------------------------------------------------------------

Sys_basher is a multithreaded memory and disk exerciser. It's purpose is to provide a system reliablity test. Sys_basher can keep all the cores in a system running at 100% capacity using 100% of the memory bandwidth. The floating point tests use the FP multipliers, adders, and memory system at the maximum possible rate, this should heat the CPU as much as any application will. It is also capable of doing continuous disk I/O to upto 32 separate directories. 

Sys_basher is a 64 bit program, it should have no trouble running on systems with > 4G of RAM. If it is compiled on a 32 bit system it will only be able to test about 3G of RAM which is the limit imposed by the 32 bit Linux kernel.

The program is POSIX compliant so it should work on any *nix system, although it's only been tested on Fedora Core 20  and Scientific Linux 6.5

Sys_basher can spawn multiple threads, each running the selected suite of tests. The default number of Cores supported is 16 however this number can be changed by modifying the MAX_CORES value in sys_structs.h and recompiling. The default thread limit is 2 which will keep both cores of a dual core system busy, the -threads switch allows the user to specify from 1 to MAX_CORES threads.

Sys_basher can test most of the physical memory on a system.  The default is to test only the free memory however a switch is provided which allows the user to set the test array size to the total memory size minus a specified number of megabytes. If the test array is set to totalmem - 1000 MBytes, or smaller, the memory tests will usually  run without swapping. To increase the amount of memory that's testable it is suggested that you run at INIT 3 (no X) with no other programs running. 

If the reserved space is set lower then this, paging will occur. Paging slows the memory tests to a crawl but has the useful side effect of causing large amounts of disk traffic.

As of rev 1.0.7 sys_basher logs CPU and system temperatures. The current temperatures are displayed after each test completes and a table of maximum temperatures is displayed at the end ot the test. Temperature logging is available for Linux only and requires the installation of lm-sensors and the libsensors development library.

As of rev 1.1.1 sys_basher produces a log file, sys_basher.log which is identical to the stdio in verbose mode.

As of rev 2.0.1 sys_basher can translate logical addresses to physical addresses and can identify individual DIMMs. Sys_basher uses the DMI (BIOS) table produced by dmidecode to
translate physical addresses to DIMM identifiers. To identify bad DIMMs use the following procedure,

as root
dmidecode --dump-bin bios.bin

as user or root

sys_basher -dmi bios.bin -m -t 256 >& log &


To run without swapping,

sys_basher -t 256

If swapping is desired then set the reserve space to 0,

sys_basher -t 0

The optimal -t value is system dependent, the only way to determine the maximum value that will not force swapping is to use the free command to determine if sys_basher is swapping. In the following for example we use swapoff and then swapon to flush the swap space
> su
> swapoff -a
> swapon -a
> exit
> sys_basher -m -t 1024 >& log &
> free
             total       used       free     shared    buffers     cached
Mem:       8113872    8069804      44068          0       2888      38004
-/+ buffers/cache:    8028912      84960
Swap:     16779852        912   16778940

------------------------------------------------------------------------------------------------------------------
Building sys_basher. 

You must have tcsh installed before you run make sys_basher.

Sys_basher can be built with or without sensors. 

To build it with sensors you will have to install the libsensors development package.

For Redhat and Clones	yum -y install lm_sensors-devel
For Ubuntu		sudo apt-get install libsensors-dev

There are now a couple of versions of libsensors, libsensors 2.x which is found in RHEL5 and CENTOS5, and
libsensors 3.x which is found in newer distros like Fedora 9. If you have tcsh installed then the Makefile
will figure out which version you have and build the correct version of sys_basher. If you don't then you
can explicitedly build the version you need as follows,

make sys_basher		Make builds with libsensors 3.x
make sys_basher2	Make for libsensors 2.x, RHEL 5x, CentOS 5x
make sys_basher3	Make for libsensors 3.x, Fedora, RHEL 6.x, SL 6.x, CentOS 6.x and all recent distros.
make nosensors		Make without lm-sensors
make win		Make for Cygwin
make install		Make sys_basher and then move it to /usr/bin

The man page is generated with help2man. To install it
Fedora			yum -y install help2man
Ubuntu			sudo apt-get install help2man
------------------------------------------------------------------------------------------------------------------
Running sys_basher

Usage: sys_basher [OPTIONS]
options:
  -d,--disk                   Run disk tests
  -dmi filename               DMI binary file generated by dmidecode --dump-bin filename
                              The DMI (BIOS) file allows sys_basher to determine which DIMM is bad
                                Example: dmidecode --dump-bin bios.bin
                                         sys_basher -v -dmi bios.bin
  -du,--dutycyle              Dutycycle n Duty cycle in percent, the default is 100
                              Inserts Sleeps between tests to reduce the overall CPU duty cycle
  -f,--fast                   Skip the memory tests, just run the disk, fp and memory bandwidth tests.
  -fp,--fp                    Run floating point tests
  -h,--help                   Print this help message
  -ho #,--hours #             Run for at least # hours.
  -i,--int                    Run integer tests
  -l #,--loops #              Number of iterations.
  -mb,--mbandwidth            Run memory bandwidth
  -m,--mem [abprwv]           Run memory tests
     No argument                Run all memory tests
     a                          Address = Data tests
     b                          Bank tests
     p                          Fixed pattern tests
     r                          Random data tests
     w                          Walking Ones/Zeros data tests
     v                          Bit reversed address tests
  -mi,--minutes #             Run for at least # minutes.
  -p n0..nx,--path n0..nx     Directory path(s) for the disk tests, upto 32 paths maybe specified. The default path is ./
  -r name,--report name       Report file name, generate name.rpt and name_xx.csv. Default is sys_basher.rpt and sys_basher_xx.csv
  -s,--swap                   Force use of swap space. This option is incredibly slow.
  -st,--stop                  Stop on Error, Exits if error found.
  -t,--totalmem #             Allocate total ram - (n * 1M) for testing. If -totalmem is not called then the free space is used.
  -th #,--threads #           Maximum number of threads. Spawn 1-n threads, the default is the number of CPUs.
  -ts #,--tstart #            Starting thread count, after the initial calibration pass loop from tstart to threads, the default is 1
  -v,--verbose                Verbose, print detailed results, for memory tests prints address and data info for the first 16 errors, default is PASS/FAIL only.
  -vv,--vverbose              Very Very verbose, for memory tests run a second check pass to help determine if it's a read or write problem
  -ve,--version               Version
The default is to run all tests unless at least one individual test group is selected.
Report and log files:
 The default report_name is sys_basher.
 The the default name can be overridden with the -r switch.
  report_name.log             Running log. Syncs are executed after each test so that this file can be preserved up to the point of a crash.
  report_name.rpt             Summary report file.
  report_name_#_threads.csv   Comma separated report files for each thread count. These files can be read into a spreadsheet.

------------------------------------------------------------------------------------------------------------------
Examples,

Run benchmarks and fast tests only,

sys_basher -fast >& log &

Run two iterations, use totalmem - 256M, do disk tests on 2 partitions,

sys_basher -loops 2 -path /fcx/projects /home/bjrosen -totalmem 256 >& log.$1 &

Run for 8 hours, use totalmem - 256M, do disk tests on 4 partitions,

sys_basher -hours 8 -path /fcw/projects /fcx/projects /fcx/projects /home/bjrosen  -totalmem 256 >& log.$1 &

Force swapping,

sys_basher -totalmem 0 >& log &

------------------------------------------------------------------------------------------------------------------
Report Files

Sys_basher generates a report in two formats, .rpt and .csv. The .rpt format is human readable text file format, .csv is a comma separated format thats allows the user to import the results into a spreadsheet.

To generate the report files use the -r switch,

sys_basher -r report

------------------------------------------------------------------------------------------------------------------
Verbosity control

The default output from sys_basher is simple pass/fail status. The -v switch adds detailed test by test status results including the temperature after each test. The information in the verbose mode is also available in the report files so for healthy systems it is recommended that you don't use the -v switch. For unstable systems the verbose mode can be very useful in determining the source of the unreliability so for systems that crash it is recommended that the -v switch be used and that the output be redirected to a log file,

sys_basher -v >& log 

------------------------------------------------------------------------------------------------------------------
Revision History
1.0.1	First version
1.0.2	Added disk tests
1.0.3	Added No sync mode for disk tests in addition to the sync mode that was introduced into 1.0.2
	Added -hours, -minutes and -path switches
	Added floating point tests
	Improved the output formatting
1.0.4	Added check to see that malloc succeeded. Fix FP Sum of Products tests.
	There are some issues with the Disk Tests which will be addressed in the next rev. 
	If the disk tests fail DON'T PANIC, it's probably my code.
1.0.5	Fixed disk tests and improved FP tests.
1.0.6	Added duty cycle control.
1.0.7	Added CPU Temperature monitoring, Cygwin support
1.0.8	Added integer arithmetic tests. Fixed Cygwin bug.
1.0.9	Added -memonly
1.1.0	Added report files, added 16 bit integer tests, added verbose mode switch. Made the number of supported cores scalable
	Cygwin version now does disk I/O and uses POSIX threads
1.1.1	Cleaned up the stdio output. Switches can be preceeded by either - or --. 
	Added transcript file, sys_basher.log
1.1.2	Added support for libsensors3
	Added --version switch
1.1.5   Added -ts switch which loops on the maximum number of threads. Improved memory tests. All integer and FP tests now 
        run for a minimum of .5 seconds. The default number of threads is set to the number of CPUs.
1.1.6   A little cleanup in the report file, no test or feature changes.
1.1.7	Added Walking One/Zero and Random memory tests.
1.1.8	Updated -help
1.1.9	Fixed Lint errors
1.2.0   Added a prototype for the open call in sys_disk
1.2.1	Improved random number test, added memory refresh test, increased default NUM_CORES to 32, Changed BuildRoot in spec file
1.2.2	Added voltage and fan speed reporting, added bit reverse address test
1.2.3	Added finer grain control over the memory tests. Added support > 8G in the bit reverse address tests.
1.2.5	Added random data memory tests, added double ckecing in memory tests (-vv) and added verbose reporting in memory tests -v or -vv
2.0.1	Can now localize memory failures to individual DIMMs. Memory is now locked as long as at least 128M is reserved for the system (-t 128) which ,ake it possible to test most of the RAM without the program paging.

