• Keine Ergebnisse gefunden

@liD[K] Add Areas

Im Dokument PR FILER " (Seite 111-117)

Choose Add Areas to specify all routines in your module as a specific routine or module that you want marked as an area. This command resembles the Module window's local Add Areas command.

@liDffi]

Remove Areas

The Remove command removes all information displayed for an area and removes that area's markers.

@liDO]

Inspect

When you choose Inspect, the profiler switches to the Module window and places the cursor on the first line of source code corresponding to the current area (the one highlighted in the Areas window).

102 Turbo Pro filer User's Guide

@!!O[QJ

Options

Figure 4.25 The Area Options dialog box

When you choose Options from the Areas window's local menu, the Area Options dialog box comes up.

You can specify three options from this dialog box: Operation, Callers, and Timing .

.. Operation specifies what profiling action will occur for the current area.

Normal collects profile statistics for this area.

Stop stops program execution at this marker.

Enable turns on the collection of statistics at this area marker.

Disable turns off the collection of statistics at this marker. Data collection resumes once program control passes an enabled marker .

.. Callers specifies which level of callers the profiler will track.

All Callers records all available call-path information for the current routine.

Immediate Callers records only IIparent" information for the current routine.

None turns off call-path information for the current routine . .. Timing specifies whether the pro filer will add the current area's

execution time to a higher-level area or keep it separate.

Separate adds any timer ticks occurring while program control is in this marked area to the area's timer-tick compartment only, not to the caller's compartment.

Combined adds timer ticks that occur while control is in this marked area to the area's timer-tick compartment and to the caller's compartment. You can specify combined time for an area only if that area's Callers setting is Immediate or All.

Chapter 4, The Turbo Profiler environment 103

104

Figure 4.26 Propagation of time

The following figure illustrates how time propagates from called routines to the calling routines when the caller's clock is set to Combined.

Clock Combined Clock

Combined Clock

Separate

In this figure, b1 's clock is combined and b1 calls c1, so c1's time is combined with b1's time. Part of c1 's time is actually d1's time, because c1 's clock is combined.

Both b1 and b2 call routine c2 .

• Routine c2's time from when b1 calls it-which includes all of d2's time-is combined with b1's time, because b1's clock is combined .

• But c2's time from when b2 calls it is not combined with b2's time, because b2's clock is separate.

~@] Sort

The Sort command rearranges the information displayed in the Areas window. You can sort alphabetically (by Name) or

numerically (by Address). Sorting by Address lists the areas in an order more consistent with the order in which they appear in your source code.

Routines The Routines window is where Turbo Pro filer displays a list of all routines that you can use as area markers. Use it when you can't remember the name of a routine, or to see which routines have areas set on them. You can use the Inspect command to go to other modules by "inspecting" a routine in a particular module.

This menu option gives you easy access to information related to a symbol.

Turbo Pro filer User's Guide

Figure 4.27 The Routines window

Figure 4.28 The Routines window local menus

The information displayed is basically a list of all global symbols available from debug information included in the executable file.

These symbols include all routine and procedure names in standard libraries for Turbo C and Turbo Pascal, as well as the names of routines in any third-party libraries you might be using (provided you link to those libraries with symbolic debug information turned on).

The Routines window is divided into two panes, left and right.

The left pane lists routines global to your whole profiled program, and the right pane lists routines that are local to the current module of the program you're profiling.

Local routines include nested routines and procedures in Pascal and static routines in C. Global routines with source code available appear highlighted in the right pane. (By default, an underscore (_) precedes all global variables in Turbo C programs.)

Both panes of the Routines window have local menus.

Left pane local menu

Areas Callers Module Profile

Right pane local menu

Local Module Areas Callers Module Profile

To alternate between the window's panes, press Tab. To activate the current pane's local menu, press AIt-F10. To activate a local menu item directly (without bringing up the menu), press the Ctfl-(Ietter) hot key, where letter is the menu item's highlighted letter.

@E[)[g

Local Module (in right pane)

When you choose Local Module in the Global Routines pane (the right pane), this Pick a Module dialog box pops up, listing all modules in your program.

Chapter 4, The Turbo Profiler environment 105

Figure 4.29 The Pick a Module dialog box

After you highlight a module and choose OK, the pro filer displays that module's local symbols in the right pane of the Routines window.

~0 Areas (in both panes)

The Areas command opens an Areas window and positions that window's highlight bar on the current routine (the one that's highlighted in the Routines window).

~@] Callers (in both panes)

The Callers command opens a Callers window and shows the curren t routine's callers.

~(0 Module (in both panes)

The Module command opens a Module window and shows the source code for the current routine.

~@] Profile (in both panes)

The Profile command opens the Execution Profile window and shows the profile statistics for the current routine.

Disassembly (CPU) The Disassembly window (labeled "CPU" when it's on the screen) displays the current area in the Module window as disassembled source code. You use the Disassembly (CPU) window to help determine if you want to rewrite parts of your program in assembly language.

106 Turbo Pro filer User's GuIde

Figure 4.30

·.7EB6:0076 9A2500C37E call far OVRDEM01.WRITEl I

OVRDEMO.50: Write2.

I

·.7EB6:007B 9A2500C07E call far OVRDEM02.WRITE2 OVRDEMO.51: until KeyPressedi

·.7EB6:00SO 9AFA02C67E call far CRT .KEYPRESSEO

7EB6:0085 oseo or al.al

IIIl1I.IIlfIIIflIIIIII _ailllU_lIIIIIIII1IIIII _11l1li I

The left part of each disassembled line shows the instruction's address, either as a hexadecimal Segment:Offset value or, if the segment value is the same as the current CS register, as a CS:Offset value. If the window is wide enough (zoomed or resized), it also displays the bytes that make up the instruction. The disassembled instruction appears to the right of each line.

In the Disassembly (CPU) window, global symbols appear simply as the symbol name. Static symbols appear (generically) as

ModName.SymbolName ModNameiSymbolName

/* Turbo C */

{ Turbo Pascal

where ModName is the module name and SymbolName is the static symbol name. Line numbers appear (also generically) as

ModName.LineNumber ModNameiLineNumber

/* Turbo C */

{ Turbo Pascal

where ModName is the module name and LineNumber is the decimal line number.

In the Disassembly (CPU) window, you can use the F2 function key to set area markers for each machine instruction you want to monitor. Any instructions marked in this fashion that have no symbol name appear in the Areas window as hex addresses in Segment:Offset form.

With the Disassembly (CPU) window's local menu commands, you can go immediately to any of these locations:

• a specified address, to examine code

• the current program location (CS:IP)

111 the destination address of the current instruction

• the previous instruction pointer address

• the address in the source code

Chapter 4, The Turbo Pro filer environment 107

108

You can also choose a local menu item to activate the Module window and move its cursor to the source for the current instruction, or to display disassembled instructions and source code three different ways.

To activate the window's local menu, press Alt-F10. To activate a local menu item directly (without bringing up the menu), press the etrl-(Ietter) hot key, where letter is the menu item's highlighted letter.

@!ill@]

Goto

When you choose Goto, a dialog box pops up and requests the address you want to go to. Enter a hexadecimal address, using the hex format of the language your program is in.

You can enter addresses outside of your program to examine code in the BIOS ROM, inside DOS, and in resident utilities.

The Previous command restores the Disassembly (CPU) window to the position it had before you chose Goto.

@!ill@]

Origin

You choose Origin to position the window's highlight bar at the current program location as indicated by the CS:IP register pair.

This command is useful when you have been looking at your code and want to get back to the address of the current instruction pOinter (CS:IP), where your program is stopped.

The Previous command restores the Disassembly (CPU) window to the position it had before you chose Origin.

Im Dokument PR FILER " (Seite 111-117)