VC Addendum Part of the Profile: dawn (Morning) Keywords: VC Profile Performance Optimization Source: original [statement] For copy, distribute, please attach this statement, thank you. Original source: http://morningspace.51.net/ ,moyingzz@etang.com
(Continued) The role of Profile helps you analyze and discover the bottleneck running, find time consuming, and help you find the code that is not executed. Thus the optimization of the program is ultimately realized. PROFILE The composition of Profile consists of 3 command line tools: Prep, Profile, PLIST. You can run the Profile in a command line, the process is: Prep reads the executable of the application and generates a .PBI file and a .pbt file; Profile According to the .PBI file, actually run and analyze the program, generate .PBO output files PREP generates a new .pbt file according to the .pbo file and .pbt file; PLIST generates readable output according to the .pbt file. Profile's specific function - Function Timing: Evaluate the time spent on the execution of a specific function. This function can be activated via the Profile dialog. In the analysis result, the FUNC TIME column records the function to run in seconds. The next column shows the percentage of the function time to account for the total runtime; the FUNC Child Time column records the function and the subunies thereof The total time spent, the next column shows the percentage of the aforementioned time of time, the number of times the hit count column records the function being called; the function name is displayed. - Function coverage: Records whether a particular function is called, which can be used to determine the unforced portion in the code. This function can be activated via the Profile dialog. The analysis results list all the functions of all analytical functions and use the * markup function. - Function Counting: The number of times the program calls a specific function. Select Custom in the Profile dialog and specify fcount.bat in Custom Settings (located in the VC98 / BIN directory). It should be noted that when specifying the directory where FCount.Bat is specified, it is best not to use the long file name, so it is possible to errors, such as writing C: / Program Files into C: / Progra ~ 1. - Line Counting: The number of times in the code executed by the program. Select Custom in the Profile dialog and specify LCOUNT.BAT in Custom Settings (located in the VC98 / BIN directory). This feature uses the debug information in .exe to start the Profile, so it doesn't need .map file. In the analysis result, the line number is labeled the line number of the source code. The Hit Count column records the number of executions, the next column shows the percentage of the number of executions of all code lines, Source Line shows the corresponding source code. - LINE COVERAGE: The particular row in the recording code is executed, which can be used to determine the unforgettable portion in the code. This function can be activated via the Profile dialog. The analysis result lists all the rows of code to be analyzed, and the line executed using the * mark. Since Line Coverage only records whether the code line is executed, its execution is smaller than the Line Counting. In addition, the Profile dialog provides a MERGE function to combine the statistics after running Profile. If you are using the function coverage feature, you will see if all functions are tested; if you are using the function Timing feature, you will see the accumulated time for all merger operations in this analysis with this analysis. Use of Profile in the IDE environment - for functions involving function analysis
Select Project-> Settings-> Link, select the Enable Profiling check box to rebuild the project Select build-> profile, pop up the Profile dialog, select OK, start running the program - For the function of the analysis
Select Project-> Settings-> Link, select the Enable Profiling check box and the Generate debug info check box Select Project-> Settings-> C / C , select the Line Numbers Only Rebuild Project Select Build-> Profile, pop up the Profile dialog After setting, select OK, start running the program configuration profile - Modify the Profiler.ini file Profiler.ini in the vc98 / bin directory, in its [PROFILER] segment, you can specify a lib file that does not participate in the analysis or Obj file. For example: [PROFILER] Exclude: User32.lib Exclude: GDI32.LIB - Specified options in the Profile dialog box If you select the Funciton Timing, Function Coverage or Line Coverage option, you can specify a further range in Advanced Settings, such as : You want PROFILE to simply analyze the code within a specific range in the sampleApp.cpp file, which can be filled in Advanced Settings, / Excall / INC SampleApp.cpp (30-67). Another example: You want file1.obj and file2.obj to participate in analysis, you can fill in the Advanced Settings, / Exc file1.Obj / Exc file2.obj. Another example: You want to only describe the specified function, you can fill in the Advanced Settings, / sf? Samplefunc @@ yaxpah @@, keeping the sf parameter is the modifier name of the specific function, get the simplest way of this name. It is found in the MAP file generated when you create a project. SF, EXCALL, EXC, INC are pre-command line parameters, and detailed descriptions of other parameters can be obtained by entering preP / h at the command line prompt. - Write a batch command file to refer to FCount.bat, Fcover.bat, FTIME.BAT, LCOUNT.BAT, and LCOVER.BAT output data PLIST / T command from Profile PLIST / T command Allow PLIST to output the contents of the .pbt file to a text file. In this format, it is suitable for input into a spreadsheet or database. For example: PLIST / T myProg> MyProg.txt, generated myprog.txt can be imported into the Microsoft Excel spreadsheet using Profiler.xlm (located in the VC98 / BIN directory). Note - Usually, the meaning of the entire program is not large, because most Windows applications, the main time spent on the message waiting, and thus accurately position the code to be analyzed, speed up the execution speed of Profile, improve its analysis accuracy. Try to close other inseparable applications during PROFILE execution. - If remote debugging is enabled, you cannot call the PROFILE function from the Build menu. - For the Inline function, the compiler replaces the function call in the actual code, so the inline function does not generate a .map file or call instruction, so when performing such a function, PROFILE will not be able to know, spend time, running, etc. Call the function of the function. Profile provides the number of running times and overwriting information about the INLINE function.
- For multi-threaded applications, PROFILE behavior depends on what you choose, for Line Counting and Line Coverage, PROFILE does not distinguish between threads, which will contain all threads currently run. For Function Timing, Function Coverage, and Function Counting, the analysis results depend on the thread, you can analyze a stand-alone thread in the following way: declare the main function of the thread as the initial function (do not use the preP / sf option) Using the Prep / EXC option) Otherwise, the analysis results are difficult to explain.