rpms/kcbench/devel kcbench-ChangeLog, NONE, 1.1 kcbench-manpage, NONE, 1.1 kcbench, 1.2, 1.3 kcbench-README, 1.1, 1.2 kcbench.spec, 1.1, 1.2

Thorsten Leemhuis (thl) fedora-extras-commits at redhat.com
Mon Dec 3 15:38:03 UTC 2007


Author: thl

Update of /cvs/pkgs/rpms/kcbench/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24174

Modified Files:
	kcbench kcbench-README kcbench.spec 
Added Files:
	kcbench-ChangeLog kcbench-manpage 
Log Message:
update to 0.2, which includes a ChangeLog and a manpage now


--- NEW FILE kcbench-ChangeLog ---
2008-12-03  Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info>

        * Version 0.2
		* add short command line options
		* make more detailed output possible
		* add ChangeLog and manpage, strip readme

2008-10-22  Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info>

		* Version 0.1.2
		* formating changes
		* make it possible to show the elapsed time from the cache run
		

2008-10-15  Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info>

        * Initial Version 0.1.1




--- NEW FILE kcbench-manpage ---
." Text automatically generated by txt2man
.TH kcbench  "1" "" ""
.SH NAME
\fBkcbench \fP- Kernel compile benchmark
.SH SYNOPSIS
.nf
.fam C
\fBkcbench\fP [\fIoptions\fP]
.fam T
.fi
.SH DESCRIPTION
Compiles a Linux kernel to benchmark a system or test its stability
.SH OPTIONS
.TP
.B
\fB-d\fP, \fB--compiledir\fP <path>
.PP
.nf
.fam C
   Use the subdirectory kcbench in <path>/ when compiling results -- passes
   'O=<path> /kcbench/' to make when calling it to compile a kernel; use a
   tempdir if not given

.fam T
.fi
\fB-r\fP, \fB--detailedresults\fP
.PP
.nf
.fam C
   Print more detailed results

.fam T
.fi
\fB-a\fP, \fB--ignore-running-apps\fP
.PP
.nf
.fam C
   Do not warn if cron or other daemons run in the background; the results
   might not be stable when those run and call jobs that consume CPU time or
   do a lot of I/O

.fam T
.fi
\fB-i\fP, \fB--infinite\fP 
.PP
.nf
.fam C
   run endlessly to test system stability

.fam T
.fi
\fB-n\fP, \fB--iterations\fP <int>
.PP
.nf
.fam C
   Number or iterations per number of jobs (default: 3)

.fam T
.fi
\fB-j\fP, \fB--jobs\fP <int> 
.PP
.nf
.fam C
   Number of jobs to use ('make -j #'); option can be given multiple times
   (default: number of CPUs * 2)

.fam T
.fi
\fB-c\fP, \fB--no-cachefill\fP
.PP
.nf
.fam C
   Omit the initial kernel compile to fill caches; saves time, but first
   result might be slightly lower then the following ones

.fam T
.fi
\fB-v\fP, \fB--verbose\fP
.PP
.nf
.fam C
   Increase verboselevel; option can be given multiple times

.fam T
.fi
\fB-l\fP, \fB--savefailedlogs\fP <path> 
.PP
.nf
.fam C
   Save log of failed compile runs in <path>

.fam T
.fi
\fB-s\fP, \fB--src\fP (<path>|<version>) 
.PP
.nf
.fam C
   Take sources in <path> or from /usr/share/kcdata/linux-<version>

.fam T
.fi
\fB-h\fP, \fB--help\fP
.PP
.nf
.fam C
   Show usage

.fam T
.fi
\fB-V\fP, \fB--version\fP
.PP
.nf
.fam C
   Output program version
.fam T
.fi
.SH ENVIRONMENT
Kcbench looks for a kernel to compile in /usr/share/\fBkcbench\fP-data and will
take the one that a "ls usr/share/\fBkcbench\fP-data | head \fB-n\fP 1" outputs by 
default
.SH EXAMPLE
To compile the default kernel 3 times in a row run:
.PP
.nf
.fam C
      $ kcbench

.fam T
.fi
To compile the defaukt kernel 3 times with 2 jobs and 3 times with 4 jobs
run
.PP
.nf
.fam C
      $ kcbench --iterations 3 --jobs 2 --jobs 4
.fam T
.fi
.SH RESULTS
By default the line you are looking for is this:
.PP
.nf
.fam C
      Run 1 (-j 4): 5775 (e:173.15P:192%  U:263.49 S:69.42 F:0)

.fam T
.fi
Here it has taken 173.15 seconds real time (e) to compile the kernel; the
CPU-Usage (P) was 192 percent; user time (U) spend was 296.49 and sys time
(S) 69.42 and there we no major page faults (see the info or man pages for
time for details about the notation).
.PP
As most people prefer if higher numbers mean faster systems -- to give them
what they expect \fBkcbench\fP divides 1000000 by the real time spend, which
results in 5775 \fBkcbench\fP points (1000000/173.15) in this example. 
.PP
When running with "\fB-r\fP|\fB--detailedresults\fP" you'll get more detailed results:
.PP
.nf
.fam C
      Run 1 (-j 4):       6662 (e:150.10 P:197% U:259.51 S:36.38 F:0)
        Elapsed Time(E): 2:30.10 (150.10 seconds)
        Kernel time (S): 36.38 seconds
        User time (U): 259.51 seconds
        CPU usage (P): 197%
        Major page faults (F): 0
        Minor page faults (R): 9441809
        Context switches involuntarily (c): 69031
        Context switches voluntarily (w): 46955
.fam T
.fi
.SH HINTS
.IP \(bu 3
sometimes using exactly as much jobs as processors in the system results in
a result that's a bit faster than the default (two times the number of
processors)
.IP \(bu 3
the compiler has a huge impact on the results; if you compare results from
different machines make sure they use a similar one. The running kernel and
its settings also have a impact on the results. Thus it's the best not to
compare different distributions/different patch levels.
.IP \(bu 3
the kernel that is being compiled of course has a huge impact as well;
compare only results where you compiled the same kernel version
.SH SEE ALSO
\fBtime\fP(1).
.SH BUGS
None know, but there are likely some
.SH AUTHOR
Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info>


Index: kcbench
===================================================================
RCS file: /cvs/pkgs/rpms/kcbench/devel/kcbench,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- kcbench	22 Oct 2007 05:57:59 -0000	1.2
+++ kcbench	3 Dec 2007 15:37:30 -0000	1.3
@@ -25,7 +25,7 @@
 
 # this is me
 myprog_name=kcbench
-myprog_version=0.1.2
+myprog_version=0.2
 
 # set some defaults -- called before cmdoptions are parsed
 kcbench_init ()
@@ -57,7 +57,7 @@
 {
 	# check for tools we need
 	# thinkaboutme: there are likely more needed
-	for tool in make gcc ld ; do
+	for tool in make gcc ld awk /usr/bin/time; do
 		if ! which ${tool} &> /dev/null ; then
 			echo "Could not find ${tool}"
 			exit 2
@@ -69,9 +69,9 @@
 		local runningtasks="$(echo $(ps -A | grep --word -e crond -e httpd -e atd -e sendmail -e smbd | awk '{print $4}' | sort | uniq))"
 		if [[ "${runningtasks}" ]] ; then
 			echo "WARNING: There are some daemons runnningin the background:" >&2
-			echo "         ${runningtasks}" >&2
-			echo "         Those might disturb the benchmark; you should disable them!" >&2
-			echo "         (use '--ignore-running-apps' to disabled this warning" >&2
+			echo "  ${runningtasks}" >&2
+			echo "  Those might disturb the benchmark; you should disable them!" >&2
+			echo "  (use '--ignore-running-apps' to disabled this warning" >&2
 			sleep 5
 		fi
 	fi
@@ -193,7 +193,6 @@
 	touch "${kcbench_logfile}"
 
 
-
 	# disable sceensaver (should we reset this? how?)
 	setterm -blank 0
 }
@@ -284,11 +283,87 @@
 	done
 }
 
+parse_results ()
+{
+	local this_resultfile="${1}"
+	local this_verboselevel="${2}"
+	local this_runtype="${3}"
+
+	while read format value; do
+		case "${format}" in
+			E)
+				local tm_elapsed="${value}"
+				;;
+			e)
+				local tm_elapsed_s="${value}"
+				;;
+			S)
+				local tm_kernel_s="${value}"
+				;;
+			U)
+				local tm_user_s="${value}"
+				;;
+			P)
+				local tm_cpu_p="${value}"
+				;;
+			M)
+				local tm_mem_max="${value}"
+				;;
+			F)
+				local tm_pgfault_maj="${value}"
+				;;
+			R)
+				local tm_pgfault_min="${value}"
+				;;
+			W)
+				local tm_swapped="${value}"
+				;;
+			c)
+				local tm_cswitched="${value}"
+				;;
+			w)
+				local tm_waits="${value}"
+				;;
+			I)
+				local tm_file_in="${value}"
+				;;
+			O)
+				local tm_file_out="${value}"
+				;;
+			x)
+				local tm_exit="${value}"
+				;;
+		esac
+	done < "${this_resultfile}"
+
+	if [[ "${this_runtype}" != "run-0-fillcaches" ]]; then
+		local time_points="$(echo 1000000/${tm_elapsed_s} | /usr/bin/bc)"
+		kcbench_echo 1 ${this_verboselevel} "${time_points} (e:${tm_elapsed_s} P:${tm_cpu_p} U:${tm_user_s} S:${tm_kernel_s} F:${tm_pgfault_maj})"
+		if [[ "${print_detailed_results}" ]]; then
+			echo "  Elapsed Time(E): ${tm_elapsed} (${tm_elapsed_s} seconds)"
+			echo "  Kernel time (S): ${tm_kernel_s} seconds"
+			echo "  User time (U): ${tm_user_s} seconds"
+			echo "  CPU usage (P): ${tm_cpu_p}"
+			echo "  Major page faults (F): ${tm_pgfault_maj}"
+			echo "  Minor page faults (R): ${tm_pgfault_min}"
+			echo "  Context switches involuntarily (c): ${tm_cswitched}"
+			echo "  Context switches voluntarily (w): ${tm_waits}"
+		fi
+	else
+		if [[ "${show_result_from_cache_free_runn}" ]]; then
+			kcbench_echo 1 2 "Done (-j ${default_number_of_jobs}, e: ${tm_elapsed_s})"
+		else
+			kcbench_echo 1 2 "Done"
+		fi
+	fi
+}
+
 
 kcbench_compile_kernel()
 {
 	local this_verboselevel="${1}"
 	local this_nrjobs="${2}"
+	local this_runtype="${3}"
 	local this_logfile="${kcbench_logdir%%/}/${3}"
 	local this_msgstart="${4}"
 
@@ -297,15 +372,9 @@
 
 	kcbench_echo 1 ${this_verboselevel} -n "${this_msgstart}"
 
-
-	if /usr/bin/time -o "${this_logfile}.time" -f "P:%P e:%e U:%U S:%S" make O="${dir_outputtmp}" -C "${dir_sources}" -j ${this_nrjobs} vmlinux >> "${this_logfile}" 2>&1 ; then
-		if [[ "${3}" == "run-0-fillcaches" ]] && [[ "${show_result_from_cache_free_run}" ]]; then
-			kcbench_echo 1 2 "Done (-j ${default_number_of_jobs}, e:$(cut -d ' ' -f 2 < "${this_logfile}.time" | cut -d ':' -f 2))"
-		else
-			local time_points="$(echo 1000000/$(cut -d ' ' -f 2 < "${this_logfile}.time" | cut -d ':' -f 2) | /usr/bin/bc)"
-			local time_details="$(cat "${this_logfile}.time")"
-			kcbench_echo 1 ${this_verboselevel} "${time_points} (${time_details})"	
-		fi
+	if /usr/bin/time -o "${this_logfile}.time" -f 'E %E\ne %e\nS %S\nU %U\nP %P\nM %M\nF %F\nR %R\nW %W\nc %c\nw %w\nI %I\nO %O\nx %x' make O="${dir_outputtmp}" -C "${dir_sources}" -j ${this_nrjobs} vmlinux >> "${this_logfile}" 2>&1 ; then
+	#if /usr/bin/time -o "${this_logfile}.time" -f 'E %E\ne %e\nS %S\nU %U\nP %P\nM %M\nF %F\nR %R\nW %W\nc %c\nw %w\nI %I\nO %O\nx %x' dd if=/dev/urandom bs=10M count=1 2>/dev/null | md5sum >> "${this_logfile}" 2>&1 ; then	
+		parse_results "${this_logfile}.time" ${this_verboselevel} "${this_runtype}"
 	else
 		kcbench_echo 2 1 "Failed ($(date))."
 
@@ -337,10 +406,10 @@
 # basic information about the system
 kcebench_sysinfo()
 {
-	kcbench_echo 1 ${1} "Linux running:      $(uname -r)"
+	kcbench_echo 1 ${1} "Linux running:      $(uname -r) on $(uname -i) ($(uname -n))"
 	kcbench_echo 1 ${1} "Compiler:           $(gcc --version | head -n 1)"
 	kcbench_echo 1 ${1} "Processor Cores:    $(grep '^processor' < /proc/cpuinfo  | wc -l) -- $(grep 'model name' /proc/cpuinfo  | sed 's!model name\t: !!' | sort | uniq)"
-	kcbench_echo 1 ${1} "Memory:             $(( $(awk '/MemTotal:/ { print $2}' /proc/meminfo) / 1024  )) MByte"
+	[[ -r /proc/memory ]] && kcbench_echo 1 ${1} "Memory:             $(( $(awk '/MemTotal:/ { print $2}' /proc/meminfo) / 1024  )) MByte"
 	kcbench_echo 1 ${1} "Linux compiled:     $(basename "${dir_sources}") (${dir_sources})"
 }
 
@@ -349,21 +418,23 @@
 	echo "Usage: ${myprog_name} [options]"
 	echo $'\n'"Compiles a kernel and messures the time it takes"
 	echo $'\n'"Available options:"
-	echo " --compiledir <path>      -- use <path>/kcbench for compile results (O=)"
-	echo " --ignore-running-apps    -- Do not warn if cron or other daemons run"
-	echo " --infinite               -- run endlessly"
-	echo " --iterations <int>       -- number or iterations"
-	echo " --jobs <int>             -- number of jobs to use ('make -j #') (*)"
-	echo " --no-cachefill           -- omit the initial kernel compile to fill caches"
-	echo " --verbose                -- increase verboselevel (*)"
-	echo " --savefailedlogs <path>  -- save log of failed compile runs in <path>"
-	echo " --src (<path>|<version>) -- take sources in <path> or from"
-	echo "                             /usr/share/kcdata/linux-<version>"
+	echo " -d, --compiledir <path>      -- use <path>/kcbench for compile results (O=)"
+	echo " -r, --detailedresults        -- print more detailed results"
+	echo " -a, --ignore-running-apps    -- Do not warn if cron or other daemons run"
+	echo " -i, --infinite               -- run endlessly"
+	echo " -n, --iterations <int>       -- number or iterations"
+	echo " -j, --jobs <int>             -- number of jobs to use ('make -j #') (*)"
+	echo " -c, --no-cachefill           -- omit the initial kernel compile to fill caches"
+	echo " -q, --quiet                  -- quiet"
+	echo " -v, --verbose                -- increase verboselevel (*)"
+	echo " -l, --savefailedlogs <path>  -- save log of failed compile runs in <path>"
+	echo " -s, --src (<path>|<version>) -- take sources in <path> or from"
+	echo "                                 /usr/share/kcdata/linux-<version>"
 	echo
-	echo " --help                   -- this text"
-	echo " --version                -- output program version"
+	echo " -h, --help                   -- this text"
+	echo " -V, --version                -- output program version"
 	echo
-	echo "(*) -- option can be past multiple times"
+	echo "(*) -- option can be passed multiple times"
 }
 
 
@@ -374,57 +445,61 @@
 # parse cmdline options
 while [ "${1}" ] ; do
 	case "${1}" in
-		--compiledir)
+		-c|--compiledir)
 			shift
 			dir_topoutput="${1}"
 			shift
 			;;
-		--jobs)
+		-r|--detailedresults)
+			shift
+			print_detailed_results="true"
+			;;
+		-j|--jobs)
 			shift
 			# without quotes, to make --jobs "4 8 16 32" possible
 			number_of_jobs="${number_of_jobs} ${1}"
 			shift
 			;;
-		--ignore-running-apps)
+		-a|--ignore-running-apps)
 			shift
 			ignore_running_apps="true"
 			;;
-		--infinite)
+		-i|--infinite)
 			shift
 			run_infinite="true"
 			;;
-		--iterations)
+		-n|--iterations)
 			shift
 			number_of_iterations="${1}"
 			shift
 			;;
-		--no-cachefill)
+		-c|--no-cachefill)
 			shift
 			no_cachefill="true"
 			;;
-		--quiet)
+		-q|--quiet)
 			verboselevel="1"
 			shift
 			;;
-		--savefailedlogs)
+		-v|--verbose)
+			shift
+			let verboselevel++
+			;;
+		-l|--savefailedlogs)
 			shift
 			savefailedlogs="${1}"
 			shift
 			;;
-		--src)
+		-s|--src)
 			shift
 			compile_srctree="${1}"
 			shift
 			;;
-		--verbose)
-			shift
-			let verboselevel++
-			;;
-		--help)
+		-h|--help)
 			myprog_help
 			exit 0
 			;;
-		--version)
+		-V|--version)
 			echo "${myprog_name} ${myprog_version}"
 			exit 0
 			;;


Index: kcbench-README
===================================================================
RCS file: /cvs/pkgs/rpms/kcbench/devel/kcbench-README,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- kcbench-README	15 Oct 2007 16:06:25 -0000	1.1
+++ kcbench-README	3 Dec 2007 15:37:31 -0000	1.2
@@ -1,102 +1,5 @@
-kcbench - Kernel compile benchmark 
+Kcbench is a kernel compile benchmark; it compiles a Linux kernel and measures
+the time it takes for performance test. Kcbench can also be used to test
+system stability.
 
-## About
-
-Kcbench compiles a Linux kernel to benchmark a system or test system stability
-
-
-## Available options:
-
- --compiledir <path>      
-   Use the subdirectory kcbench in <path>/ for compile results -- passes
-   'O=<path> /kcbench/' to make when calling it to compile a kernel; use a
-   tempdir if not given
-
- --ignore-running-apps
-   Do not warn if cron or other daemons run in the background; the results
-   might not be stable when those run and call jobs that consume CPU time or
-   do a lot of I/O
-
- --infinite 
-   run endlessly to test system stability
-
- --iterations <int>
-   Number or iterations per number of jobs (default: 3)
-
- --jobs <int> 
-   Number of jobs to use ('make -j #'); option can be given multiple times
-   (default: number of CPUs * 2)
-
- --no-cachefill
-   Omit the initial kernel compile to fill caches; saves time, but first
-   result might be slightly lower then the following ones
-
- --verbose
-   Increase verboselevel; option can be given multiple times
-
- --savefailedlogs <path> 
-   Save log of failed compile runs in <path>
-
- --src (<path>|<version>) 
-   Take sources in <path> or from /usr/share/kcdata/linux-<version>
-
- --help
-   Show usage
-
- --version
-   Output program version
-
-
-## Examples:
-
- $ kcbench
-   Takes newest kernel from /usr/share/kcdata/ and compiles three times
-
- $ kcbench--iterations 3 --jobs 2 --jobs 4
-   Compile 3 times with 2 jobs and three times with 4 jobs
-
-
-## Example output:
-
-$ kcbench --iterations 2 --jobs 2 --jobs 4 --jobs 8 --ignore-running-apps 
-Linux running:      2.6.23-0.222.rc9.git4.fc8
-Compiler:           gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-31)
-CPU:                2 x Intel(R) Core(TM)2 CPU          6400  @ 2.13GHz
-Memory:             1964 MByte
-Linux compiled:     linux-2.6.20 (/usr/share/kcbench-data/linux-2.6.20)
-Filling caches:     Done                                                      
-Run 1 (-j 2):       5858 (P:195% R:170.70 U:263.51 S:69.42)
-Run 2 (-j 2):       5830 (P:194% R:171.51 U:263.92 S:69.39)
-Run 3 (-j 4):       5727 (P:193% R:174.60 U:267.12 S:70.42)
-Run 4 (-j 4):       5779 (P:194% R:173.03 U:266.74 S:70.09)
-Run 5 (-j 8):       5636 (P:191% R:177.43 U:270.14 S:70.39)
-Run 6 (-j 8):       5607 (P:190% R:178.32 U:269.64 S:70.88)
-
-
-## Results
-
-In this example
-
- Run 1 (-j 4): 5775 (P:192% R:173.15 U:263.49 S:69.42)
-
-is has taken 173.15 seconds real time (R) to compile the kernel; the CPU-Usage
-(P) was 192 percent; user time (U) spend was 296.49 and sys time (S) 69.42.
-
-As most people prefer if higher numbers mean faster systems -- to give them
-what they expect kcbench divides 1000000 by the real time spend, which results
-in 5775 kcbench points (1000000/173.15) in this example. 
-
-
-## Usage hints
-
- * sometimes using exactly as much jobs as processors in the system results in
-   the a result faster than the default (two times the number of processors)
-
- * the compiler has a huge impact on the results; if you compare results from
-   different machines make sure they use the same one
-
- * the kernel that is being compiled of course has a huge impact as well;
-   compare only results where you compiled the same kernel version
-
-
-## EOF
+For informations how to use please consult the the man page with "man kcbench".


Index: kcbench.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kcbench/devel/kcbench.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- kcbench.spec	15 Oct 2007 16:06:25 -0000	1.1
+++ kcbench.spec	3 Dec 2007 15:37:31 -0000	1.2
@@ -1,6 +1,6 @@
 Name:           kcbench
-Version:        0.1
-Release:        2
+Version:        0.2
+Release:        1.1
 Summary:        Kernel compile benchmark
 
 Group:          Applications/System
@@ -8,6 +8,8 @@
 URL:            http://fedoraproject.org/wiki/Packages/kcbench
 Source0:        kcbench
 Source1:        %{name}-README
+Source2:        %{name}-ChangeLog
+Source3:        %{name}-manpage
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
@@ -20,7 +22,7 @@
 Requires:       %{_bindir}/time %{_bindir}/bc
 
 %description
-Compiles a linux kernel to benchmark a system or test system stability.
+Compiles a linux kernel to benchmark a system or test its stability.
 
 
 %prep
@@ -36,6 +38,8 @@
 rm -rf ${RPM_BUILD_ROOT}
 install -D -p -m 0755 %{SOURCE0} ${RPM_BUILD_ROOT}%{_bindir}/kcbench
 install -D -p -m 0644 %{SOURCE1} ./README
+install -D -p -m 0644 %{SOURCE2} ./ChangeLog
+install -D -p -m 0644 %{SOURCE3} ${RPM_BUILD_ROOT}%{_mandir}/man1/kcbench.1
 
 
 %clean
@@ -44,11 +48,15 @@
 
 %files
 %defattr(-,root,root,-)
-%doc README
+%doc README ChangeLog
 %{_bindir}/kcbench
+%{_mandir}/man1/*
 
 
 %changelog
+* Mon Dec 03 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]org> - 0.2-2
+- update to 0.2, which includes a ChangeLog and a manpage now
+
 * Sat Oct 13 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]org> - 0.1-2
 - require make gcc and binutils, needed for kernel compile
 - require /usr/bin/{time,bc} for kcbench




More information about the fedora-extras-commits mailing list