home *** CD-ROM | disk | FTP | other *** search
- % Copyright (C) 1993, 1994 Aladdin Enterprises. All rights reserved.
- %
- % This file is part of Aladdin Ghostscript.
- %
- % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- % or distributor accepts any responsibility for the consequences of using it,
- % or for whether it serves any particular purpose or works at all, unless he
- % or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- % License (the "License") for full details.
- %
- % Every copy of Aladdin Ghostscript must include a copy of the License,
- % normally in a plain ASCII text file named PUBLIC. The License grants you
- % the right to copy, modify and redistribute Aladdin Ghostscript, but only
- % under certain conditions described in the License. Among other things, the
- % License requires that the copyright notice and this notice be preserved on
- % all copies.
-
- % bench.ps
- % This file is a "wrapper" for benchmarking.
- % It writes timing results on a file called:
-
- /BOF where { pop } {
- /BOF (bench.out) def
- } ifelse
-
- % Switch to global VM so odef will work.
-
- /currentglobal where
- { pop currentglobal true setglobal /setglobal cvx }
- { { } }
- ifelse
-
- % Make sure all execution occurs under a `save'.
-
- save pop
-
- % Set the output device to an image device.
-
- (%END) .skipeof %****************
-
- /Resolution where { pop } { /Resolution 100 def } ifelse
- [ Resolution 72.0 div 0 0 Resolution -72.0 div 0 792 ]
- Resolution 8.5 mul cvi
- Resolution 11.0 mul cvi
- <00 ff>
- makeimagedevice
- setdevice
-
- %END
-
- % Redefine 'run' so that it collects timing information.
-
- /.orig.run /run load def
- /.run.finish % <file> <time> .run.finish <file>
- { usertime exch sub
- 1 index =string cvs .bench.file exch writestring
- .bench.file (: run time = ) writestring
- =string cvs .bench.file exch writestring
- .bench.file ( ms\n) writestring
- .bench.file flushfile
- } bind def
- /run % <string> run -
- { % We construct a bound procedure here so that
- % we can invoke run recursively.
- cvlit
- 2
- { /.orig.run load
- save countdictstack 3 index usertime /.run.finish cvx
- 7 array astore cvx exec
- exch countdictstack exch sub { end } repeat
- exch restore
- }
- repeat
- % Don't do the save & restore the last time.
- /.orig.run load
- 1 index usertime /.run.finish cvx
- 5 array astore cvx exec pop
- } bind odef
-
- % Force a quit after processing files.
-
- /.bench.file BOF (w) file def
- /executive { .bench.file closefile quit } def
-
- % Make sure we don't incur any pauses.
-
- /NOPAUSE true def
-
- exec % restore currentglobal
-