user guide seriesthe stack holdings is the number of stack traces taken at those times, and the heap...

51
Profiling Investigating application performance? The Sparx Systems Enterprise Architect Profiler finds the actions and their functions that are consuming the application, in a few seconds. The Execution Analyzer applies both Process Sampling and Process Hooking. Enterprise Architect User Guide Series Author: Sparx Systems Date: 2020-09-07 Version: 15.2 CREATED WITH

Upload: others

Post on 24-Sep-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

ProfilingInvestigating application performance? TheSparx Systems Enterprise Architect Profilerfinds the actions and their functions that areconsuming the application, in a few seconds.The Execution Analyzer applies both Process

Sampling and Process Hooking.

Enterprise Architect

User Guide Series

Author: Sparx SystemsDate: 2020-09-07

Version: 15.2

CREATED WITH

Page 2: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that
Page 3: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

Table of Contents

Profiling 4System Requirements 12Getting Started 14Call Graph 18Stack Profile 21Memory Profile 24Memory Leaks 27Setting Options 31Start & Stop the Profiler 35Function Line Reports 38Generate, Save and Load Profile Reports 41Save Report in Team Library 50

Page 4: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Profiling

During the lifetime of software applications, it is notuncommon to investigate application tasks that aredetermined to be performing slower than expected. Youmight also simply want to know what is going on when you'press this button'! You can work this out quite quickly inEnterprise Architect by using its Profiler. Results canusually be produced in a few seconds and you will quicklybe able to see the actions that are consuming the applicationand the functions involved. In the Execution Analyzer, Thefeature employs two separate strategies; Process Samplingand Process Hooking. In one, samples are taken at regularintervals to identify CPU-intensive patterns, while in theother, the process is hooked to record demands made onmemory. Data is analyzed to produce a weighted CallGraph. Behaviors are usually identifiable as root nodes(entrypoints) in the graph, or branches near these points. All

(c) Sparx Systems 2020 Page 4 of 51

Page 5: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

reports can be reviewed on demand. They can be saved tofile within the model, both as Artifact elements and as TeamLibrary posts.

Access

Ribbon Execute > Tools > Profiler

Other Execution Analyzer toolbar : AnalyzerWindows | Profiler

Call Sampling

The Profiler is controlled using its toolbar buttons. Here youcan attach the Profiler to an existing process (or JVM), orlaunch the application for the active Analyzer Script. TheProfiler window displays the details of the target process as

(c) Sparx Systems 2020 Page 5 of 51

Page 6: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

it is profiled. These details provide feedback, letting you seethe number of samples taken. You also have options forpausing and resuming capture, clearing captured data andgenerating reports. You can gain access to the reportingfeature by pausing the capture - the reporting feature isdisabled whilst data capture is in progress.

Weighted Call Graph

This detailed report shows the unique set of CallStacks/behaviors as a weighted Call Graph. The weight of

(c) Sparx Systems 2020 Page 6 of 51

Page 7: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

each branch is depicted by a hit count, which is the total hitsof that branch plus all branches from this point. Byfollowing the hit trail, a user can quickly identify the areasof code that occupied the program the most during thecapture period.

Stack Profile

Stack Profiles are a taken to discover the different ways(stacks) and the count of ways that a particular function isinvoked during the running of the program. Unlike other theother profiler modes, this profile is activated through the useof a Profile Point, which is a special kind of breakpointmarker. The marker is set in the source code like any otherbreakpoint. When the breakpoint is encountered by theprogram, the stack is captured. When you later produce the

(c) Sparx Systems 2020 Page 7 of 51

Page 8: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

report, the stacks are analyzed and a weighted call graphproduced. The graph shows the unique stacks that wereinvolved in that function during the time the profiler wasrunning, The 'Hit Count' column indicates the count of timesthat same stack occurred.

Memory Profiles

The Memory profile tracks allocations, ignoring when

(c) Sparx Systems 2020 Page 8 of 51

Page 9: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

memory is freed. It uses this information to rate theexecuting code's demands for memory, in terms not of theamount of memory but of the frequency of demands. TheAllocations figure is the total number of memory allocationsrequested. The Stack Holdings is the number of stack tracestaken at those times, and the Heap Holding figure is the totalamount of memory obtained by these calls. Note thatprofiling can be turned on and off on demand. There is alsono need to rebuild your program to get it to work as there isno linkage involved.

Memory Graph

This example is of a report produced from Profiling ademonstration program in the Xerces project from Apache.The program iterates over the Document Object Model(DOM) for a provided XML file.

(c) Sparx Systems 2020 Page 9 of 51

Page 10: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Function Summary Report

This summary report lists the functions and only thosefunctions executed during the sample period. Functions arelisted by total invocations, with a function that presentstwice in separate Call Stacks appearing before a functionthat appears just the once.

Function Line Report

(c) Sparx Systems 2020 Page 10 of 51

Page 11: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

This detailed report shows the source code for a functionline by line displaying beside it the total times each wasexecuted. We uncovered code using this report, that exposedcase statements in code that never appeared to be executed.

Support

The Profiler is supported for programs written in C, C++,Visual Basic, Java and the Microsoft .NET languages.Memory profiling is currently available for native C andC++ programs.

Notes

The Profiler is available in the Enterprise Architect·

Professional Edition and above

The Profiler can also be used under WINE (Linux and·

Mac) for Profiling standard Windows applicationsdeployed in a WINE environment

(c) Sparx Systems 2020 Page 11 of 51

Page 12: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

System Requirements

Using the Profiler, you can analyze applications built forthese platforms:

Microsoft TM Native (C++, C, Visual basic)·

Microsoft .NET (supporting a mix of managed and·

unmanaged code)

Java·

Microsoft Native applications

For C, C++ or Visual Basic applications, the Profilerrequires that the applications are compiled with theMicrosoft TM Native compiler and that for each application ormodule of interest, a PDB file is available. The Profiler cansample both debug and release configurations of anapplication, provided that the PDB file for each executableexists and is up to date.

Microsoft .NET applications

For Microsoft .NET applications, the Profiler requires thatthe appropriate Microsoft .NET framework is installed, andthat for each application or module to be analyzed, a PDBfile is available.

(c) Sparx Systems 2020 Page 12 of 51

Page 13: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Java

For Java, the Profiler requires that the appropriate JDK fromOracle is installed.

The classes of interest should also have been compiled withdebug information. For example: "java -g *.java"

New instance of application VM is launched from·

Enterprise Architect - no other action is required

Existing application VM is attached to from within·

Enterprise Architect - the target Java Virtual Machine hasto have been launched with the Enterprise Architectprofiling agent

These are examples of command lines to create a Java VMwith a specific JVMTI agent:

java.exe -cp "%classpath%;.\" -agentpath:"C:\Program1.Files (x86)\Sparx Systems\EA\vea\x86\ssamplerlib32"myapp

java.exe -cp "%classpath%;.\" -agentpath:"C:\Program2.Files (x86)\Sparx Systems\EA\vea\x64\ssamplerlib64"myapp

(Refer to the JDK documentation for details of the-agentpath VM startup option.)

(c) Sparx Systems 2020 Page 13 of 51

Page 14: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Getting Started

The Profiler can be used to investigate performance issues,providing four separate tools for you to choose from,namely:

Call Graph·

Stack Profile·

Memory Profile·

Memory Leaks·

You select these tools from the Profiler toolbar.

Access

Ribbon Execute > Tools > Profiler

Tools

Tool Description

Call Graph Analyzes performance by taking samplesduring an activity in a program. Eachsample represents a stack. The samples

(c) Sparx Systems 2020 Page 14 of 51

Page 15: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

are taken at intervals controlled using thetoolbar. In this scenario, poorperformance is rated by the patterns ofbehavior that repeat the most during thesample time period. This figure is used toweight the Call Graph produced.

MemoryProfile

Analyzes performance by hooking thememory allocations made by a program.In this scenario, poor performance israted by the activities making the mostrequests for memory. This figure is usedto weight the Call Graph produced.

Stack Profile The Stack Profiler enables you to set amarker in your source code so thatwhenever execution hits that marker, afull stack trace is captured. As theapplication continues executing and themarked position is accessed from avariety of places within the runningexecutable, a very detailed and usefulpicture is built up showing hot spots andusage scenarios for a particular point incode.The Stack Profile report, like the MemoryProfile report, is displayed in 'reversestack' order. This means that the root ofthe report is always a single node (in this

(c) Sparx Systems 2020 Page 15 of 51

Page 16: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

case the marker) and the tree then fansout to show all the various places themarked position has been accessed from.

MemoryLeaks

Analyzes memory leaks by hooking thememory operations performed by aprogram. What is produced is a CallGraph presenting the Call Stacks thatallocated memory for which a freeoperation was not detected.

Toolbar Buttons

Button Action

Displays a menu of options for managingyour Profiling session.

Launches the configured application to beprofiled. By default, this is theapplication configured in the activeAnalyzer Script.

Indicates the state of the sampler. Whengreen, sampling is enabled; when red,sampling is disabled.

(c) Sparx Systems 2020 Page 16 of 51

Page 17: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Stops the Profiler process; if any sampleshave been collected, the Report buttonand Discard Data button are active.

Generates a report from the current datacollection.

Displays the Profiling tool in use, whichdetermines the fields shown in theProfiler window. Click on the drop-downarrow and select a different tool, whichchanges the window fields.

Discards the collected data. You areprompted to confirm the discard.

Displays the Help topic for this window.

(c) Sparx Systems 2020 Page 17 of 51

Page 18: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Call Graph

Quickly discover what a program is doing at any point in·

time

Easily identify performance issues·

Be surprised how quickly you can realize improvements·

See your improvements at work and have the evidence·

Support for C/C++, .NET and Java platforms·

Usage

The 'Call Graph' option is typically used in situations where

(c) Sparx Systems 2020 Page 18 of 51

Page 19: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

an activity is performing slower than expected, but it canalso be used simply to better understand the patterns ofbehavior at play during an activity.

Operation

The Profiler operates by taking samples - or Call Stacks - atregular intervals over a period of time; the interval is setusing the Profiler toolbar. You use the Profiler to run aparticular program, or you can attach to an existing process.The Profiler capture is controlled, and you can pause andresume capture at any time. You can also elect to havecapture initiated immediately when the Profiler is started. Ifnecessary, you can discard any captured samples and startagain during the same session. If you cannot continue withthe same session, restarting the Profiler is quick and easy.

Results

Results can be produced at any time during the session;however, capture must be disabled in order for the Reportbutton to become active. It is up to you to decide how longyou let the Profiler run. You might know when an activity isfinished, or it might be apparent for other reasons. Thereason you are here might be that an activity is notcompleting at all.

(c) Sparx Systems 2020 Page 19 of 51

Page 20: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

You enable the Report button by either pausing capture orstopping the Profiler altogether.

Results are displayed in a Report view. The report openswith two tabs initially visible: the Call Graph and theFunction Summary. The reports can be saved to file, storedin the model as Artifacts or posted in the Team Library.

(c) Sparx Systems 2020 Page 20 of 51

Page 21: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Stack Profile

The Stack Profiler enables you to set a marker in yoursource code so that whenever execution hits that marker, afull stack trace is captured. As the application continuesexecuting and the marked position is accessed from avariety of places within the running executable, a verydetailed and useful picture is built up showing hot spots andusage scenarios for a particular point in code.

The Stack Profile report, like the Memory Profile report, isdisplayed in 'reverse stack' order. This means that the root ofthe report is always a single node (in this case the marker)and the tree then fans out to show all the various places themarked position has been accessed from.

Usage

(c) Sparx Systems 2020 Page 21 of 51

Page 22: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Use the Stack Profile mode to produce a report that showsthe unique ways in which a function can be invoked duringthe running of a program. Determine the parts of the modelthat rely on this function and their frequency.

Operation

Profiler modes are selected using the Profiler controlToolbar. If a Profiler Point is already created, it is displayed.The Profiler Point is the point at which stack traces arecaptured. You can set the Profiler Point using the Set buttonon the control itself, once the mode is selected. Afterdeciding on the Profile Point, build the project to be sureeverything is up to date, then start the Profiler. The numberof unique stack holdings detected is visible during the run.

Results

A results can be produced by clicking the report button on

(c) Sparx Systems 2020 Page 22 of 51

Page 23: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

the Profiler control Toolbar. This button is enabled wheneither:

Capture is turned off (using the Pause Button) or·

The Profiler is stopped (using the Stop Button)·

The results produced are displayed as a weighted call graph,where the lines on the graph represent a unique stack, andweighted to show the higher frequency stacks first. Thereport can then be saved, either to file or to the model, usingthe context menu of the report itself.

(c) Sparx Systems 2020 Page 23 of 51

Page 24: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Memory Profile

Quickly rate performance of activities that interest you·

Nothing influences a discussion more than evidence·

Reward your efforts by working in those areas that will·

make a difference

Surprise yourself by delivering optimizations you might·

not have known existed

(c) Sparx Systems 2020 Page 24 of 51

Page 25: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Usage

The Memory Profile can be used to reveal how activitiesperform in regard to memory consumption. Using thismode, a user would be interested in questioning thefrequency of demands made for memory during a task. Theywould be less interested in the actual amount consumed. Awell managed activity might make relatively few calls toallocate resources but allocate enough memory to do its jobefficiently. Other activities might make many thousands ofrequests, and that typically makes them less efficient. Thismode is useful for detecting those scenarios.

Operation

The Memory Profile works by hooking the process inquestion, so that program has to be launched using the toolin Enterprise Architect. Unlike the Call Graph option, youcannot attach to an existing process. When the program isstarted, hooking mechanisms track the allocation ofmemory; this information is collected and collated inEnterprise Architect. You can easily monitor the number ofallocations being made. Also, the process is controlled; thatis, the memory hooks can be turned on and off on demand.If you might have mistimed some action, you can pausecapture, discard the data and resume capture again easily.

(c) Sparx Systems 2020 Page 25 of 51

Page 26: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Results

Results can be produced at any time during the session;however, capture must be disabled in order for the Reportbutton to become active. It is your decision how long you letthe Profiler run. You enable the Report button by eitherpausing capture or stopping the Profiler altogether.

Results are displayed in a Report view. The report initiallyopens with two tabs visible; a single weighted Call Graphand a Function Summary. The Call Graph depicts all theCall Stacks that led to memory allocations, which areaggregated and weighted according to the frequency of thepattern.

Requirements

For best results, the image and its modules should be builtwith debug information included, and without optimizations.Any module with the Frame Pointer Omission (FPO)optimization is likely to produce misleading results.

(c) Sparx Systems 2020 Page 26 of 51

Page 27: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Memory Leaks

The Profiler control, showing the count of memoryallocations and the count of operations that are memory free.

A well behaved program.

Memory leak detection is a road well traveled. Althoughmany other good options are available, we believe ourapproach has major benefits, such as:

(c) Sparx Systems 2020 Page 27 of 51

Page 28: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

No changes at all to existing project build·

No header files required by the project code·

No runtime dependencies to worry about·

No system configuration to think about·

Usage

A person would use this mode to track memory leaks in anapplication or in an activity within the application. Amemory leak from the Profiler's point of view is a successfulcall made to a memory allocation function that returns amemory address for which no matching call is made to freethat address.

Operation

The Memory Leak detection works through hooking. Thememory routines of the process are hooked to track whenmemory is both allocated and freed. Call Stacks are capturedat the point of the allocation and this information is collatedin Enterprise Architect to produce a report in the form of aCall Graph. Capture is controlled; that is, the hookingmechanisms can be enabled or disabled on demand.

Depending on the type of program and its memoryconsumption, you could employ an appropriate strategy. Forsmall programs, you might track the program from start to

(c) Sparx Systems 2020 Page 28 of 51

Page 29: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

finish. For larger windowed programs, you would probablydo better by toggling capturing before and after a specifictask to avoid tracking too much data.

Results

Results can be produced at any time during the session;however, capture must be disabled in order for the Reportbutton to become active. It is your decision how long you letthe Profiler run. You enable the Report button by eitherpausing capture or stopping the Profiler altogether.

Results are displayed in a Report view. The report initiallyopens with two tabs visible; a single weighted Call Graphand a Function Summary. The Call Graph depicts all theCall Stacks that led to memory allocations, and areaggregated and weighted according to the frequency of thepattern.

Reports can contain a variable amount of 'noise'. To focuson an area you have specific concerns for, locate a functionknown to you in the summary report and use that to navigatedirectly into the line in the graph where it is featured.

Requirements

For best results, the image and its modules should be builtwith debug information included, and without optimizations.

(c) Sparx Systems 2020 Page 29 of 51

Page 30: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Any module with the Frame Pointer Omission (FPO)optimization is likely to produce misleading results.

(c) Sparx Systems 2020 Page 30 of 51

Page 31: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Setting Options

The first icon on the Profiler window toolbar displays a listof options that you can set to tailor your Profiling session.

Options

Option Description

Attach toRunningProcess

Select this option to display the 'Attach toProcess' dialog, from which you choosean active process to Profile.

Switch toDebugger

Select this option to change operationsfrom Profiling to Debugging. TheDebugger has an equivalent drop-downmenu option that you can use to switchfrom Debugging to Profiling.

(c) Sparx Systems 2020 Page 31 of 51

Page 32: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Load Report Select this option to load a previouslysaved report from the file system.

AnalyzerScripts

Select this option to open the AnalyzerScript window, which is the modelrepository for configuring builds,debugging, and all other VisualExecution Analyzer options.

DelaySampling

Select this option to set a delay betweenclicking on a 'Start Profiling' option andthe Profiling actually beginning. Thedelay can be 3, 5 or 10 seconds. Select'None' to cancel any delay set.

CallGraphAggregates

Method

When this option is selected, instances ofthe identical stack sequences areaggregated by method. That is to say, linenumbers / instructions within a methodare ignored, so two stacks will be countedas one where they differ only by linenumber in their final frame.

CallGraphSamples

Include WaitState

When this option is selected, the Profilerwill sample all threads, including those inWait states. When unselected, the Profileronly samples threads that haveaccumulated CPU time since the last

(c) Sparx Systems 2020 Page 32 of 51

Page 33: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

interval expired.

StartSampling

Immediately

Select this option to trigger DataCollection immediately on launch. Youwould typically use this option to profilea process during start up.

DiscardFragments

When stacks cannot be reconciled to theentry point of a thread they are referred toas fragments. The number of fragmentsencountered during sampling is displayedin the sampler Summary window. Youcan set this option to collect or discardfragments; when the Discard Fragmentsoption is:

Selected, fragments do not appear in·

the reports, although the numberencountered is still updatedDeselected, a special collection named·

'fragments' is created in the call graphto house them, and to ensure they datais not mixed in with the completesamples

CaptureDebugOutput

(Applies to Process Sampling). Whenselected, output normally visible duringdebugging is captured and displayed inthe Debug window. Note that only debugbuilds will typically emit debug output.

(c) Sparx Systems 2020 Page 33 of 51

Page 34: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Stop Processon Exit

This option determines terminationbehavior for the Profiler. When the optionis selected, the target process willterminate when the Profiler is stopped.

(c) Sparx Systems 2020 Page 34 of 51

Page 35: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Start & Stop the Profiler

Profiling is a two stage process of data collection andreporting. In Enterprise Architect the data collection has theadvantage of being a background task - so you are free to doother things while it runs. The information sent back toEnterprise Architect is stored until you generate a report. Toview a report, the capture must be turned off. After thereport is produced you can resume capture with the click ofa button. If, for some reason, you decide to scrap your dataand start again, you can do so easily and without having tostop and start the program again.

Access

Ribbon Execute > Tools > Profiler > OpenProfiler

Other Execution Analyzer toolbar : AnalyzerWindows | Profiler

(c) Sparx Systems 2020 Page 35 of 51

Page 36: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Actions

Action Detail

Toolbar

StrategySelection

Select the Profiling strategy from theavailable options on the Toolbar.

Start theProfiler

Click the Run button on the Profilerwindow

Stop theProfiler

The process exits if:You click on the Stop button·

The target application terminates, or·

You close the current model·

If you stop the Profiler and the process isstill running, you can quickly attach to itagain.

Pause andResumeCapture

You can pause and resume capture at anytime during a session.When capture is turned on, samples arecollected from the target. When paused,

(c) Sparx Systems 2020 Page 36 of 51

Page 37: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

the Profiler enters and remains in a waitstate until either capture is enabled, theProfiler is stopped or the applicationfinishes.

GenerateReports

The Report button is disabled duringcapture but is available when capture isturned off.

Clear DataCollection

You can clear any data samples collectedand resume at any time. First suspendcapture by clicking on the Pause button.The Discard button, as for the Reportbutton, is enabled whenever capture isturned off. In clicking on the Discardbutton you will be asked to confirm theoperation. This action cannot be undone.

(c) Sparx Systems 2020 Page 37 of 51

Page 38: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Function Line Reports

After you have run the Profiler on an executing applicationand generated a Sampler report, you can further analyze theactivity of a specific function listed in the report bygenerating a Function Line report from that item. AFunction Line report shows the number of times each line ofthe function was executed. You produce one Function Linereport at a time, on any method in the Sampler report thathas a valid source file. The Function Line report isparticularly useful for functions that perform loopscontaining conditional branching; the coverage can providea picture of the most frequently and least frequentlyexecuted portions of code within a single method.

The line report you generate is saved when you save theSampler report. The body of the function is also saved withthe Function Line report to preserve the function state at thattime.

Platforms supported

Java, Microsoft .NET and Microsoft native code

Create a Line Report

In the Sampler report, right-click on the name of the

(c) Sparx Systems 2020 Page 38 of 51

Page 39: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

function to analyze, and select the 'Create Line report forfunction' option.

Once the Profiler binds the method, the Function Line reportis opened on the Sampler Report window. The report showsthe body of the function, including line numbers and text.As each line is executed a hit value will accumulate againstthat line. A timer will update the report approximately onceevery second.

(c) Sparx Systems 2020 Page 39 of 51

Page 40: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

End Line Report Capture

Once enough information is captured, or the function hasended, click on the Profiler toolbar Stop button to stoprecording the capture.

Save Reports

Use the Save button on the Call Stack toolbar to save theSampler report and any Function Line reports to a file.

Delete Line Reports

Closing the 'Line Report' tab will close that report but thereport data will only be deleted when the report is saved.

(c) Sparx Systems 2020 Page 40 of 51

Page 41: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Generate, Save and Load ProfileReports

Reports can be produced at any time during a session, ornaturally when a program ends. To enable the Report buttonwhile the program is running, however, you need to suspendProfiling by toggling the Pause/Resume button, or byterminating the Profiler with the Stop button. You havesome options for reviewing and sharing the results:

View the report·

Save the report to File·

Distribute the report as a Team Library resource·

Attach the report as a document to an Artifact element·

Synchronize the model by reverse engineering the source·

code that participated in the profile

Access

Ribbon Execute > Tools > Profiler > CreateReport from Current Data

Profiler From the Profiler window, click on the icon in the toolbar.

(c) Sparx Systems 2020 Page 41 of 51

Page 42: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Load Report from File

The option is available from the drop down menu of theProfiler Window

Generate Report

From the Profiler window, click on the icon in the toolbar.

CallFrequency Report

(c) Sparx Systems 2020 Page 42 of 51

Page 43: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Function Summary

(c) Sparx Systems 2020 Page 43 of 51

Page 44: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Unfiltered Summary Report listing all participatingfunctions in order of inclusive hits.

You can filter and reorganize the information in the report,in the same way as you do for the results of a Model Search.

Report Options

Right-click on the report to display the context menu.

(c) Sparx Systems 2020 Page 44 of 51

Page 45: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Action Detail

Show Sourcefor Function

For the selected frame, select this optionto display the corresponding line of codein a code editor. Frames that have sourceavailable are identifiable by their icon.

Find inSummaryWindow

Select this option to locate the function inthe Summary window.

CollapseGraph

Select this option to collapse the entiregraph including child nodes, visible ornot.

Collapse toNode

Select this option to collapse the entiregraph, then expand and set the focus tothe selected node.

Follow MaxAllocations

Select this option to expand an entire linein the graph.

Create LineReport forFunction

Select this option to launch the Profiler (ifit is not already running), immediatelybind the selected function and ready it forrecording. Once bound, an extra tab isopened in the current Report View. Thisreport will update instantaneously,showing the number of times each line

(c) Sparx Systems 2020 Page 45 of 51

Page 46: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

executed. Of course, the report willcontinue to record activity in the functioneven if is not visible.Note: In windowed programs, it isusually necessary to take some action inthe application to cause the function to beinvoked.

CreateFunctionGraph

Select this option to create an additionaltab, which shows the selected function inisolation. For a Call Frequency Profile,this produces a graph showing all thelines that led to this function being called(that is, the callers). For a MemoryProfile, this produces a graph showing alllines that emanate from this function (thatis, the callees).

Mark InitialFrame forCall StackDiagram

Use prior to creating a Call Stacksequence diagram to limit the stacklength. When this option is selected, theframe is marked and its text ishighlighted. Frames above this one willthen be excluded from any Sequencediagram produced.

RemoveMark

Removes the mark from a frame that waspreviously marked as 'Initial'.

(c) Sparx Systems 2020 Page 46 of 51

Page 47: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Create CallStackDiagram

Generates a sequence diagram for asingle stack in the graph. The selectedframe is depicted as the terminal frame inthe stack. The initial frame of the stackdefaults to the root node if no 'Initial'frame has been marked.

CreateWeightedCall GraphDiagram

Generates a sequence diagram thatpresents a sequence for each visible stackbranching from the selected frame. Byexpanding and collapsing the nodes ofinterest, a user can tailor the sequencediagram content to their liking.

Display theHeaviestWeightedUse

Select this option to display the line in thegraph with the highest weight in whichthis function appears.

Display theNextWeightedUse

Select this option to navigate to the nextline in the graph where the functionappears.You can use the shortcut key combinationCtrl+Down Arrow.

Display thePreviousWeightedUse

Select this option to navigate to theprevious line in the graph where thisfunction appears.You can also use the shortcut key

(c) Sparx Systems 2020 Page 47 of 51

Page 48: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

combination Ctrl+Up Arrow

Save Reportto File

Select this option to display the 'Save As'dialog, allowing you to choose where tostore the report.

Save Reportto Artifact

Note: Before selecting this option, go tothe Browser window and select thePackage or element under which to createthe Artifact element.You are prompted to provide a name forthe report (and element); type this in andclick on the OK button.The Artifact element is created in theBrowser window, underneath the selectedPackage or element.If you add the Artifact to a diagram as asimple link, when you double-click onthe element the report is re-opened.

Team Library Options

Option Description

Make Reporta Team

You can save any current report as aresource for a Category, Topic or Post in

(c) Sparx Systems 2020 Page 48 of 51

Page 49: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

LibraryResource

the Team Library to share and review atany time, as it is saved with the model.The report can also be compared withfuture runs.To begin this process, on the 'TeamLibrary context menu select the menuoption 'Share Resource | Add ActiveProfiler Report'.

Notes

If you add the Profiler report to an Artifact element and·

also attach a Linked Document, the Profiler report takesprecedence and is displayed when you double-click on theelement; you can display the Linked Document using the'Edit Linked Document' context menu option

(c) Sparx Systems 2020 Page 49 of 51

Page 50: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

Save Report in Team Library

You can save any current report as a resource for aCategory, Topic or Document in the Team Library. Thereport can then be shared and reviewed at any time as it issaved with the model. This helps you to:

Preserve a Profiler report to compare against future runs·

Allow other people to investigate the profile·

Access

ContextMenu

Right-click in Team Library window |Share Resource | Active Profiler Report

(c) Sparx Systems 2020 Page 50 of 51

Page 51: User Guide SeriesThe Stack Holdings is the number of stack traces taken at those times, and the Heap Holding figure is the total amount of memory obtained by these calls. Note that

User Guide - Profiling 7 September, 2020

(c) Sparx Systems 2020 Page 51 of 51