Profiling a Visual COBOL managed code application.


Profiling a Visual COBOL managed code application.

This article aims to provide a "getting started" overview of a possible profiling option for use with a Visual COBOL Managed code Solutions. Note, there are other 3rd party .NET managed code profiler tools available to use, but this article only looks at using the profiler tool that ships with Visual Studio.

Visual COBOL offers a profiling tool for native Cobol but currently there is no equivalent profiling tool available for managed Cobol, for  .NET Framework based managed code applications.


The Visual Studio Profiler can also be used to analyse Native code running within a managed Code Solution, but the profiler report is not as clear or easy to understand as many of the section names used in the Cobol Source are converted to internal .NET type names.

Fortunately the Visual Studio Profiler tool can still be used to great effect, as drilling down through the report will show the source code and same functionality as found with an only managed code project.

The Visual Studio Profiler can be used to analyse .NET COBOL applications, for example how long a certain code statements takes to execute.

Each use case would be different, depending on the issue to be determined, but in general the Visual Studio profiling tools offers a good  level of detail in the report it generates.

Please follow the series of screenshots below to see how to get started with the Visual Studio Profiler:
1. Ensure the solution open in Visual COBOL for Visual Studio, is the one to generate a profiler report against.
2. On the Visual Studio menu click on Analysis > Run Code Analysis:


3. This opens the Code Analysis View. From here right click on the relevant report Entry and click on Start Profiling:


The profiling tool is now executing, gathering data, depending on the size of the application this can take a few minutes.


4. When complete, the report should be shown and visible as seen in the screenshot below:


5. This view shows a high-level overview of the application. The next actions to take would be to select the components of the application to understand more about (profiling). For example, to understand which part of the application takes a long time to complete look at the Inclusive samples column, The screenshot below shows that the Micro Focus Cobol File handler component took roughly 35 % of the total time the application took to complete:

6. Next, click on that entry in the report to drill down to the Source code that took 35% of execution time, to help understand what the code is doing here.  

Once selected, the report will spilt into several box shaped entries, with each box representing different parts of the application, or methods contained.

Continue to click on the first box in the report diagrams such as the one shown in the screenshot below

7. Keep on clicking the first box/square/Calling Functions box until the source code view is shown, such as shown below:


8. This shows useful information, such as the highlighted Source Code statement with percentage values next to each statement. These percentages give more information regarding how long that part of the application took to execute, which can help to understand performance issues, or to highlight how to improve the Cobol application’s process flow.


This article is only intended to serve as a basic guide on how to get started with the Visual Studio profiler, to analyse Visual COBOL managed Code Applications. This tool has many more options and features. For further information for this tool, it is recommended to visit Microsoft’s resources to better understand it’s other features.


Comment List