Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Design

Profiling Windows C++ Applications with Microsoft Excel


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.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.