Aprobe Examples
Aprobe's examples are located in Aprobe\Examples folder.
The folder contains 4 subfolders:
-
Demo - contains two demonstration examples
which provide an introductory discussion and illustration of Aprobe's
features. The Demo/C example is the "Demo Workspace" you're
offered when you first start Aprobe. If you haven't at least tried that
one, you should do that first.
-
Simple - contains basic examples with which
one should be familiar to be comfortable with using Aprobe tool.
The Simple examples build on each other and one should go through them
sequentially.
-
Advanced - contains examples to which
one can refer when solving a particular problem with Aprobe. These
examples are independent of each other and have descriptive names which
should give you a clue as to which one you need.
-
Predefined - contains examples and
descriptions of some of Aprobe's built-in probes.
-
Target - contains sample programs that are used as
targets of the probes in several examples.
You can run each of the examples from the
Aprobe Workspace
(also known as the "Aprobe GUI") as well as from the Aprobe command line.
Running Examples from the Aprobe Workspace
Running examples from the
Aprobe Workspace
is the simplest way to do it. Simply
choose the item corresponding to the example you would like to run from
the File->Example Workspaces menu, e.g.
File->Example Workspaces->Simple->Ex01_Subprogram_Probes
and follow the instructions in the help file that will be opened for you
automatically in your default browser (which may be covered by your Aprobe
window.) Click Contents... under the Help
menu in the Aprobe Window for more information on the Aprobe Window.
Building the Probes
Generally the first thing you have to do in an example is to Compile
or
Build your probes to create the User Action Library, or
UAL
which is the .dll file that contains the compiled probes. This
is done by choosing Build from the Build
menu, or from the popup menu you get by right-clicking on the top element
in the workspace tree. This will invoke the apc
command, whose command-line and output are shown in the message window
along the bottom of the Aprobe window.
Running with Aprobe
When the directions tell you to run the target program with Aprobe
you do it by selecting Run with Aprobe from the Run
menu, or by right-clicking on the top element of the workspace tree on
the left, and choosing the first entry in that popup menu, e.g.,
Run
..\..\Target\Hello.exe with Aprobe. This will open up a Command
Prompt window in which the application is run using the aprobe
command. When it's completed and you've examined the output, you can close
that window.
Running without Aprobe
When the directions tell you to run the target program without Aprobe,
you do it by selecting Run without Aprobe from the Run
menu or the right-click popup menu on the top element of the workspace
tree on the left. This will open up a Command Prompt window in which the
application will run. When it's completed and you've examined the output,
you can close that window.
Formatting the Logged Data
Many of the examples use the Aprobe log directive to
efficiently log data for later "formatting". This is done by applying
the apformat command
to the .apd file(s) created when running with aprobe. Most examples
that require this also automatically format after you
close the window in which aprobe is run, so you won't need to do this
step manually, but you should try it to see how it's done.
To Format the results:
-
Refresh the workspace by choosing Refresh from the Workspace
menu. (This will ensure that the latest .apd files are visible)
-
Right-click on the .apd file produced by the run, e.g.,
Hello-0.apd
to get its popup menu.
-
Choose the first item in the popup menu, e.g., Format hello-0.apd
This will open a window within the Aprobe window containing the formatted
results.
Editing Apc and Rebuilding
Sometimes the directions will call for editing Apc file. This can
be done with the built-in editor, which can be invoked by double clicking
on the Apc file from the file tree panel or from the menu. After
you edit the Apc file you have to save and then rebuild it as described
above in
Building the Probes.
Running Examples from the Command Prompt
"Power users" of aprobe will often use the DOS command prompt to enter
commands. Some of the examples, such as Advanced/Perfmon,
require using the command line.
To run examples from the command line you must first obtain a DOS command
line prompt window. We recommend you do this from the Aprobe's Start menu
entry:
Start->Programs->Aprobe->Aprobe Command Prompt
Or from the Aprobe window by selecting Command Prompt from
the Run menu.
Once you get a command line shell window you can navigate between the
examples directory using DOS commands. Each example's folder should contain
a Makefile that automates the running of each example.
Building the Target program and the Probes
To build the example's target program and the probes simply type:
nmake
This will produce a .dll file containing the probe patches described
by the corresponding .apc file (e.g., Hello.apc is compiled
into Hello.dll. It may also build the target program for your probes
if it doesn't exist already.
To run the program under Aprobe with the probe patches simply type:
nmake test
This will run the target program under aprobe, applying to it the
probes contained in the .dll file(s) produced in the previous
step.
For those examples that use Aprobe logging facility (log statements
in the Apc files) the above command will also run apformat tool
on the binary APD file produced by the aprobe run.
You can also do the steps above using the apc,
aprobe and apformat
commands directly. This should be easy to do after you first run nmake
and observe the commands it executes. You can find the detailed description
of these tools by clicking the links above to Appendix
A or the Aprobe User's Guide.
Let's Go!
So, if you haven't already, let's proceed to the first
Simple example!.