Testing CD-ROM Drive Performance with DOSSPEED
Performance is the most difficult measurement to make of CD-ROM drives. The MPC system specification states that an acceptable CD-ROM drive must be able to sustain data transfer rate of 150 KB/sec without consuming more than 40% of the CPU band-width with certain lead-time parameters. The program DOSSPEED measures CD-ROM drive performance for multimedia applications, allowing for these conditions.
DOSSPEED was first shipped with the Microsoft CD-ROM Extensions (MSCDEX) in October of 1990. This version of the program fixes some problems that were found, provides more meaningful statistics, and includes some testing aids and sample output files. 
This technical note presents four items about DOSSPEED:
1.	Installing DOSSPEED.
2.	Running DOSSPEED to measure CD-ROM drive performance in data streaming applications.
3.	Describing how DOSSPEED works.
4.	Interpreting DOSSPEED test results. 
Installing DOSSPEED
You can install DOSSPEED and other related files onto your system by copying the distribution diskette to your hard disk. The following procedure places these files in a new directory called CDROMTST:
1.	From the DOS prompt, enter the following command and press ENTER to create the CDROMTST subdirectory on your hard disk:
	MKDIR \CDROMTST
2.	Copy the files from the distribution diskette to CDROMTST. The following command assumes the distribution diskette is in drive A and the current drive is a hard disk:
	COPY A:*.*   \CDROMTST
	The following files are included in this package:  
	BLKTEST.BAT		batch file that calls DOSSPEED, varying the requested block size 
CDTEST.BAT		control batch file, calls BLKTEST.BAT with varied requested transfer
			rates
CHARTMKR.XLM	Excel 3.0 macro to process batch file outputs
DOSSPEED.EXE	test program
SAMPLE.OUT		Sample output produced by batch files
SONY11.XLC		Sample chart produced by CHARTMKR.XLM
SONY21.XLC		Sample chart produced by CHARTMKR.XLM
3.	Change the current working directory to CDROMTST with the following command:
	CD \CDROMTST
You can now run DOSSPEED directly from the DOS prompt or from the batch files in \CDROMTST.
Running DOSSPEED
From the \CDROMTST subdirectory, you can run DOSSPEED. The batch files included with this package provide a starting point by running a standard series of tests, varying the requested data transfer rates and data block sizes. Running DOSSPEED from the DOS prompt allows you to explore more deeply into the performance characteristics of the CD-ROM drive; you define the parameters for DOSSPEED to use, instead of relying solely on the settings used by the batch files. The remainder of this section divides in two pieces. The first piece describes how to run DOSSPEED from the batch files; the second piece describes DOSSPEED and its parameters.
Running DOSSPEED from Batch Files
The batch files CDTEST.BAT and BLKTEST.BAT test a wide range of CD ROM performance parameters by successively calling DOSSPEED.EXE. Test results from the batch files are stored in a text file.
CDTEST.BAT calls the second batch file BLKTEST.BAT several times, passing it the requested data transfer rate in increments of 30 KB/sec starting at 30 KB/sec and ending with 150 KB/sec. In accordance with the MPC specification, the primer size matches the requested block size in the batch file tests. CDTEST also passes the name of the test file located on the CD-ROM to BLKTEST.BAT. 
BLKTEST.BAT in turn calls DOSSPEED.EXE specifying the following command line options:
1.	Name of the test file located on the CD ROM.
2.	Requested transfer rate (ranges in value from 30 KB/sec to 150 KB/sec).
3.	Requested block size (ranges from 4 KB to 64 KB).
4.	Requested primer size (Matches the requested block size).
5.	Terse output mode flag.
These batch files perform a basic set of tests. To perform additional tests, edit the batch files--including the appropriate conditions for your tests. Or, run DOSSPEED directly from the DOS prompt.
To run DOSSPEED from the batch files:
1.	Start at the DOS prompt. If you've loaded Windows, exit from the Windows Program Manager. DOSSPEED needs to run from the original copy of the command processor; not a secondary copy started from Windows. 
2.	Type the following command at the DOS prompt and press Enter. 
	CDTEST <test file name> <log file name>
	Replace <test file name> with the name of the test file to be accessed from the CD-ROM drive. Specify a file of at least 1M to obtain accurate results.	
	Also, replace <log file name> with the name of a file to hold the results of the test. 
The following example runs DOSSPEED from the batch files and specifies the D:\SOL.HLP file as the test file accessed by the CD-ROM drive; SOL.HLP is located on the Multimedia Windows MDK developers CD-ROM, if you choose to use it. The example stores test results in the TEST.LOG file located in the current working directory and runs in approximately 2 1/2 hours..
	CDTEST   D:\SOL.HLP   TEST.LOG
Running DOSSPEED from the DOS prompt
When you run DOSSPEED from the DOS prompt, use the original copy of the command processor. If you've loaded Windows, exit from the Windows Program Manager. DOSSPEED needs to run from the original copy of the command processor; not a secondary copy started from Windows. 
At the DOS prompt, type the following command and press Enter. 
	DOSSPEED <test file name> <options>
Replace <test file name> with the name of the test file to be accessed from the CD-ROM drive. Specify a file of at least 1M to obtain accurate results.
The string <options> represents command line options that you can invoke with DOSSPEED. To see a list of the DOSSPEED options, run DOSSPEED without using any command line arguments--no test file name and no options. Otherwise, replace <options> with one or more of the following DOSSPEED options: 
-r:TransferRate
DOSSPEED sets its timings based on this value to simulate an application that imposes a sustained data read rate of TransferRate.  The default transfer rate is 150K/sec.

Example:	-r:148k	(Read data at 148K/sec.)
-b:BlockSize 
DOSSPEED calculates the time to wait between reads based on this value and the requested transfer rate, and issues a read of this size after each wait.

Example:	-b:16k	(Issue 16K reads.)
-p:Primer 
The p parameter specifies the number of bytes to prime the buffer.  Priming is accomplished by waiting the proper amount of time, based on this value, before entering the main read loop.

Example:	-p:12s	(Prime the buffer with 12 sectors.)
-t	
The t parameter specifies terse output--a single line of information separated by commas. Statistics are output in a format suitable for reading by other programs. The terse output format follows:
	<test file name> , <requested transfer rate> , <blocksize> , <primer> , <background cpu activity> , <bytes read from file> , <overall transfer rate> , <% time cpu blocked in read>
	The fields <test file name>, <requested transfer rate>, <blocksize>, and <primer>, identify the file and input values DOSSPEED uses for the test. For information on the four remaining fields, see the section Interpreting Results from DOSSPEED.
-f	
Requests data from the CD-ROM without any delays between reads. (This is the , same as giving the -r: parameter a very large value.)
All DOSSPEED parameters use bytes as the default units. For convenience, you may append a character (K or S) after the number to indicate other units:
	k or K		: Kilobytes (1024 Bytes)
	s or S		: Sectors (2K, or 2048 Bytes)
How DOSSPEED Works
This sections provides a procedural description of DOSSPEED. 
Initially, DOSSPEED parses the command line and sets the requested block transfer rate, block size, and primer delay to the values supplied from the command line arguments. DOSSPEED assigns default values to the parameters that are not specified on the command line. DOSSPEED continues with the next step.
Second, DOSSPEED opens the test file on the CD-ROM and reads the first 2KB block of the file to start filling the read-ahead buffer and starts a timer set to the primer delay interval. DOSSPEED allows the buffer to fill to the desired point by waiting for the primer delay interval expire. DOSSPEED continues with the next step.
Third, DOSPEED gets the current time and resets the timer for the next read interval. The program reads the next portion of the file to fill the block-sized buffer. If the end of the data file is reached, DOSSPEED closes the file and writes out statistics. Otherwise, the program continues processing with the next step.
Fourth, DOSSPEED waits for the timer to expire. It's during this waiting period that your mulitimedia application does its processing. When the timer expires, DOSSPEED loops back to the third step to read the next block.
Interpreting Results from DOSSPEED
DOSSPEED provides the following set of information each time you run it:
Background CPU Activity
DOSSPEED attempts to discover how much CPU time the driver uses when it is not blocked for read.  An example of this phenomenon is overhead during read-ahead created by DMA transfers and interrupt processing.  The number shown by DOSSPEED shows how much a foreground task would be slowed by the driver during read-ahead.  For example, if the number shown is 10%, then an operation in your application (displaying an animation, for example) that would normally take 100ms, will actually take 110ms (10% more) when the driver is fetching data in the background.  Average the results of multiple runs of this test for the best interpretation. If DOSSPEED reports "No Background CPU activity detected" on some runs and not on other runs, then use the values given and ignore the notice. (DOSSPEED may not be able to detect the CPU activity on every run.)  Note that this test may indicate other sources of DMA and interrupt activity, such as network or serial port cards.

Time to wait for buffer to prime
We read 2K (one sector) to start the read-ahead process, and then we wait for Prime Bytes (-p:Prime) to appear in the buffer.  The amount of time we wait is based on the off-disk transfer rate of 150K/Sec, and is not based on the user-specified testing rate.
Number of Reads
This shows the number of reads issued as the test progresses. It appears as "PRIME" while DOSSPEED is waiting for the buffer to prime.
(Long)
If the time to perform a single read is longer than the calculated waiting period between reads, this item is printed after the current read number to identify when timing begins to stray. 
Data Read
Shows the total number of Bytes and Blocks read from the file.
Read exceeded Xms Y times
The number of times that (Long) was printed. (See above.)
Longest/Shortest time blocked
This shows the longest and shortest amount of time blocked in the read call, and gives the associated effective data rates.  The maximum data rate is an indication of the "Burst" data rate, which shows hows quickly buffered data is transferred to application space.
Overall
This shows the overall (average throughout the entire test) transfer rate and percent time spent waiting for reads to complete.
Using Test Results From the Batch Files
After the CD ROM performance tests have been run and the data has been collected in the output log file, you can load the results into a spreadsheet and generate charts of the data. You can load the file manually into EXCEL or use the EXCEL macro file "CHARTMKR.XLM" included in this package (located in the directory with DOSSPEED).
To make charts using the Excel macro CHARTMKR:
1.	Start Excel 3.0. The CHARTMKR macro should work with earlier versions of Excel, but has only been tested Excel release 3.0.
2.	Open the macro file into EXCEL and run it by pressing the button titled "Main".
3.	CHARTMKR.XLM prompts you for the name of the log file. Enter the log file name you specified in the batch file command. Excel generates two charts from the data in the log file. The sample charts included in this memo resulted from a CD-ROM drive that meets the MPC level 1 specification.
The first chart shows the actual data transfer rate returned by DOSSPEED for each requested transfer rate as a function of the requested read block size. Using one primer block, the CD-ROM was able to maintain each requested data transfer rate, including the MPC standard rate of 153600 bytes/sec. 
The second chart shows the amount of I/O band width blocked by the act of the device driver reading the CD ROM, again as a function of the read block size. This chart shows the CD-ROM drive using approximately 30% of the CPU band-width, which is well within the MPC specification of 40%. Once you construct similar charts for your tests, you can edit the titles in any way you see fit.