FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
June 14, 2006

Profiling Windows C++ Applications with Microsoft Excel

(Page 3 of 4)

Tool

I decided to develop a script in VBScript to process the final CSV files. To provide a user-friendly GUI for the script, I embedded the VBScript code in a Dynamic HTML file. While the HTML is very good at creating GUI's easily, I hated the unnecessary security warnings issued when I run the tool. I recalled that Microsoft introduced the HMTL Applications with the Internet Explorer 5 and later. The HMTL Applications run as trusted applications and as such are not subject to the same security constraints as Web pages. Moreover, the HTA's have read/write access to the files on the client machine. It is very easy to convert an HTML file to an HTA file. The HTA:APPLICATION tag and attributes tell the window how to behave as an application. This tag must appear within the paired HEAD tags; see Listing Five. The HTA files require Microsoft Internet Explorer. Note that the tool works very slowly when there are a lot of data, say 50K!

<head>
<title>Process Profiler Data</title>
<hta:application id="PPD"
     border="thin"
     borderstyle="normal"
     icon=""
     maximizebutton="yes"
     minimizebutton="yes"
     singleinstance="yes"
     sysmenu="yes"
     version="1.0"
     windowstate="maximize"
     navigable="yes"
/>
</head>
Listing Five: hta:application Tag

The ProcessProfilingData.hta tool contains VBScript code embedded into an HTML user interface; see Figure 1. Note that the HTA extension means it is an HTML Application. The GUI works top-to-down. Initially all the steps marked red and only the first step is enabled.

[Click image to view at full size]
Figure 1: ProcessProfilingData.hta tool.

At this step the user is expected to specify a Microsoft Excel file which the tool will create. By default the file name starts with "profiling_". After the user completes the first step, it is marked green and the second step is enabled. Similarly the third step is enabled when the second step is completed and marked green. At this point all the user needs to do is pressing the "Process Data" button. Then, the tool processes all the CSV files found in the specified directory, converts the delta values to milliseconds, draws two charts and marks the third step green. One chart is on the call cost in milliseconds; see Figure 2.

[Click image to view at full size]
Figure 2: Sample Call Cost Chart.

The other chart is on the hit count; see Figure 3. Besides creating a Microsoft Excel file, the tool exports the charts as gif files, too. So, the users may easily use the charts in any documentation.

[Click image to view at full size]
Figure 3: Sample Hit count Chart.
Previous Page | 1 Introduction | 2 The Upside of Macros | 3 The Tool | 4 Checking Memory Operators Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK