11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

86 • Chapter 3: <strong>Programming</strong> with Modulesthen only those which have actually been called are chosen. The finalstatement> map( parse, map( substring,> map( convert, S, ’string’ ),> 7 .. -1 ) )first converts the names to strings, then removes the "TRACE/" prefixby forming the substring from the seventh position to the end ofthe string, and finally calls parse on each string to convert it to theprocedure for which profiling data is stored.Using the Package As with all packages, you can access the coveragepackage interactively by using the with command.> with( coverage );Warning, the protected name profile has been redefinedand unprotected[covered , profile]A list of the package exports is returned. Alternatively, the package exportscan always be accessed by using the long forms coverage:-profileand coverage:-covered.Suppose that you want to test the procedure copy (chosen because itis short). This procedure produces a new copy of a table, array, or rtable.Now that the coverage package has been globally imposed by using with,simply call> profile( copy );1The return value of 1 indicates that, as expected, one procedure wasinstrumented. Next, call copy with a few arguments (output suppressed):> copy( table() ):> copy( array( 1 .. 3 ) ):Using covered, copy has its profiling information stored.> covered( ’nonzero’ );[copy]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!