WINDEV Concepts
Part 4: Advanced concepts 155 Creating a trace file During long processes (batch processing, etc.), to check the operating mode of the program, you must keep a physical trace of the processes run (a text file, for example). The following procedure allows you to define how the trace will be displayed: • on the screen (/DEBUG parameter in command line). • in a text file (default mode). PROCEDURE MyTrace(StringToTrace) FilePath is string FilePath = fDataDirUser() + ProjectInfo(piProjectName) + ".txt" File is int DebugMode is boolean = False IF Position(CommandLine(), "/DEBUG") > 0 THEN DebugMode = True END IF DebugMode = True THEN Trace(StringToTrace) ELSE File = fOpen(FilePath, foCreateIfNotfound + foWrite + foAdd) IF File <> -1 THEN DateTimeTrace is DateTime DateTrace is Date TimeTrace is Time DateTimeTrace = SysDateTime() DateTrace = MyDate.Date TimeTrace = MyDate.Time fWriteLine(File, DateToString(DateTrace) + ... " - " + TimeToString(TimeTrace)) fWriteLine(File, StringToTrace) fWriteLine(File, " ") fClose(File) END END Remarks : • The trace file is created by default in the user data directory. The name of this file is the same as the project name. This file contains the information to trace during the program execution. The information is completed by the date and time of each "Trace". This allows you to detect a potential problem during the process. • Example of trace file content: 01/12/2015 - 10:53:25:20 Customer name: Montgomery 6 Performance test 6.1 Overview The performance profiler checks and optimizes the execution time of the application. The principle is straightforward: When you test your application, the performance profiler keeps track of all the actions performed and the corresponding processes executed. At the end of the test, the performance profiler displays: • the 10 most time-consuming operations • all actions performed in the application that was tested, sorted by duration (from the longest to the shortest action). You can select a process to analyze its processing time and optimize it. 6.2 Starting the performance profiler To start the performance profiler, go to the "Project" tab, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance". The project is automatically run in test mode. The process to optimize can be run in your application. To go back to the editor, simply close the application. The performance profiler displays the result of the analysis. Remark : It is recommended to use the performance profiler to optimize the application (before it is distributed, for example).
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==