worldstone: add -s for statistical profiling
This commit is contained in:
		
							parent
							
								
									7047e014c9
								
							
						
					
					
						commit
						24776434f5
					
				| @ -6,6 +6,7 @@ | |||||||
| .Nd shell script to consistently execute benchmarks | .Nd shell script to consistently execute benchmarks | ||||||
| .Sh SYNOPSIS | .Sh SYNOPSIS | ||||||
| .Nm worldstone | .Nm worldstone | ||||||
|  | .Op Fl s   | ||||||
| .Op Fl n Ar iterations | .Op Fl n Ar iterations | ||||||
| .Op Fl c Ar command | .Op Fl c Ar command | ||||||
| .Op Fl p Ar command | .Op Fl p Ar command | ||||||
| @ -44,6 +45,11 @@ branch in /usr/src. | |||||||
| 
 | 
 | ||||||
| The options are as follows: | The options are as follows: | ||||||
| .Bl -tag -width Ds | .Bl -tag -width Ds | ||||||
|  | .It Fl s | ||||||
|  | If set, perform statistical profiling by invoking | ||||||
|  | .Xr profile 1 | ||||||
|  | and executing sprofalyze, suitable for feeding to sprofdiff. This | ||||||
|  | requires building world with SPROFILE. | ||||||
| .It Fl n Ar iterations | .It Fl n Ar iterations | ||||||
| Set the number of iterations to perform, after the initial run. | Set the number of iterations to perform, after the initial run. | ||||||
| The default is 5. | The default is 5. | ||||||
|  | |||||||
| @ -7,9 +7,10 @@ TAG=time.$(basename $(git --git-dir=/usr/src/.git describe --all --dirty)) | |||||||
| 
 | 
 | ||||||
| set -e | set -e | ||||||
| 
 | 
 | ||||||
| while getopts "n:d:p:c:r:" c | while getopts "n:d:p:c:r:s" c | ||||||
| do | do | ||||||
|         case "$c" in |         case "$c" in | ||||||
|  | 		s)	PROFILE=1 ;; | ||||||
| 		n)	ITERATIONS=$OPTARG ;; | 		n)	ITERATIONS=$OPTARG ;; | ||||||
| 		p)	PRECMD="$OPTARG" ;; | 		p)	PRECMD="$OPTARG" ;; | ||||||
| 		c)	COMMAND="$OPTARG" ;; | 		c)	COMMAND="$OPTARG" ;; | ||||||
| @ -43,12 +44,17 @@ echo "First run." | |||||||
| sh -c "$PRECMD" | sh -c "$PRECMD" | ||||||
| sh -c "$COMMAND" | sh -c "$COMMAND" | ||||||
| 
 | 
 | ||||||
|  | if [ "$PROFILE" ]; then profile stop || true; fi | ||||||
|  | 
 | ||||||
| for n in `seq 1 $ITERATIONS` | for n in `seq 1 $ITERATIONS` | ||||||
| do	echo -n "$n" | do	echo -n "$n" | ||||||
| 	sh -c "$PRECMD >/dev/null 2>&1" | 	sh -c "$PRECMD >/dev/null 2>&1" | ||||||
| 	echo -n "." | 	echo -n "." | ||||||
| 	sync | 	sync | ||||||
|  | 	PROF=$LOGFILE.p.$n | ||||||
|  | 	if [ "$PROFILE" ]; then profile start --rtc -o $PROF -f 3; fi | ||||||
| 	time -C sh -c "$COMMAND >/dev/null 2>&1; sync" 2>>$LOGFILE | 	time -C sh -c "$COMMAND >/dev/null 2>&1; sync" 2>>$LOGFILE | ||||||
|  | 	if [ "$PROFILE" ]; then profile stop; sprofalyze -d $PROF >$PROF.d; fi | ||||||
| 	echo -n " " | 	echo -n " " | ||||||
| done | done | ||||||
| echo "Done." | echo "Done." | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ben Gras
						Ben Gras