![]() |
The Magic Profiler |
IntroductionAn useful tool is the Magic profiler. The aim of the profiler is to resolve two problems : what task takes so long to run (and why ?), and are my tables correctly pre-opened ? The Magic profiler makes two files : the first traces the program executions, and gives details like how much time a task has run (such total time, file opening time, sort time, ...) ; the second traces opening/reopening/closing of tables For more details look at the Magic documentation, that describes this two files (search for profiler in the help file). UtilizationI recommend you to make a batch that activates the profiler. As the profiler slows down the engine, you shouldn't always activate it. The batch task contains : SET MGPROF = 1 SET MGTLOG = C:\MGTLOG.TXT SET MGTCNF = C:\MGTCNF.TXT Where the environment variable MGPROF is set to 1 in order to activate the behavior, MGTLOG is the program execution trace file, and MGTCNF the opened files trace file. To use the profiler, launch a DOS box then this batch file. The environments variables are local to this DOS box, so you must launch Magic from this DOS box. The easiest way is to simply drag your Magic shortcut from your desktop folder and drop to the DOS box.
You can also put you shortcut in the batch file, but as i have several shortcuts (for different applications, different Magic versions), i prefer this solution. The Magic session you've launched has the profiler activated, just launch the programs you want to look at, then quit Magic and edit (with your preferred text editor) the trace files to analyze your program. |