Game Development Reference
In-Depth Information
FileLog::log( File read [start]: Handle ID: %x amount %d ,
handle, amount);
}
// Log the handle has completed.
void FileReadCompletionCallback( FileHandle * handle,
FileReadCallback * callback )
{
FileLog::log( File read [end]: Handle ID:% s , handle );
// Now call the game provided callback to let it know the
// read operation completed.
callback( handle );
}
Listing 11.12. Sample showing file logging integrated into File IO functions.
The file activity log will need to be written out to a file. Complications arise
when trying to write the log file to the same device on which you are trying to
test your file's streaming performance. There are several possible solutions to this
problem. For instance, you may set up a network connection to another machine
that performs the file logging. This machine can be the same one that runs the
runtime visualization component as a separate application. With this method, you
send the log of file activity data to the connected machine to be written out to a
file. Alternatively, you may be able to use a different storage device for writing the
log that will not clash with the streamed file I/O you are monitoring.
Runtime visualization component. While the game is running, the runtime vi-
sualization part of the tool should be notified of the currently logged line of file
activity. The logged string can be parsed to find the type of operation being per-
formed and to update the display accordingly. The component will show the names
of all files currently opened and the amount of data being read in from their last
read request. The runtime visualization component can either be run in a separate
window (possibly as a separate application) or display its data on the game screen
if there is enough screen space. If the runtime visualization is executed as a sepa-
rate application, then the game can send the current line of the activity log to the
visualizer and have the component write out the log onto its host PC after it has
parsed the results and updated its display.
Post run analysis component. With a file log showing all the file operations that
have been performed throughout a game-play session, we have the opportunity to
take a closer look at what operations were performed, and this allows us to create
some optimizations on how we load our files.
The tool works by parsing the file log and generating a report. Listing 11.13
shows how we parse the file and generate a table of read conflicts (where multiple
files are reading at the same time).
Search WWH ::




Custom Search