The Flex profiler is made up of several views (or panels) that present profiling data in different ways. The following table describes each of these views:
|
View |
Description |
|---|---|
|
Profile |
Displays the currently connected applications, their status, and all the memory and performance snapshots that are associated with them. Initially, profiling sessions start with no recorded performance or memory snapshots. |
|
Saved Profiling Data |
Displays a list of saved snapshots, organized by application. You can load saved profiling data by double-clicking the saved snapshot in this list. For more information, see Saving and loading profiling data. |
|
Live Objects |
Displays information about the classes used by the current application. This view shows which classes are instantiated, how many were created, how many are in the heap, and how much memory the active objects are taking up. For more information, see Viewing information in the Live Objects view. |
|
Memory Snapshot |
Displays the state of the application at a single moment in time. Contrast this with the Live Objects view, which is updated continuously. The Memory Snapshot view shows how many objects were referenced and used in the application and how much memory each type of objects used at that time. You typically compare two memory snapshots taken at different times to determine the memory leaks that exist between the two points in time. You view the Memory Snapshot view by clicking the Take Memory Snapshot button and then double-clicking the memory snapshot in the Profile view. For more information, see Using the Memory Snapshot view. |
|
Loitering Objects |
Displays the objects that were created between two memory snapshots and still exist in memory or were not garbage collected. You can double-click a class name in the table to open the Object References view. This lets you examine the relationship between the selected objects and the other objects. You view the Loitering Objects view by selecting two memory snapshots and clicking the Loitering Objects button. For more information, see Using the Loitering Objects view. |
|
Allocation Trace |
Displays method statistics when comparing two memory snapshots. You view the Allocation Trace view by selecting two memory snapshots and then clicking the View Allocation Trace button. For more information, see Using the Allocation Trace view. |
|
Object References |
Displays objects and the objects that reference them. You view the Object References view by double-clicking a class name in the Memory Snapshot or Loitering Objects views. For more information, see Using the Object References view. |
|
Object Statistics |
Displays details about the caller and callee of the selected group of objects. You view the Object Statistics view by double-clicking an entry in the Allocation Trace view. For more information, see Using the Object Statistics view. |
|
Performance Profile |
Displays how the methods in the application performed during a given time interval. You then click a method name in the table to open the Method Statistics view, which lets you locate performance bottlenecks. You view the Performance Profile view by double-clicking one of the performance snapshots in the Profile view. For more information, see Using the Performance Profile view. |
|
Method Statistics |
Displays the performance statistics of the selected group of methods. You view the Method Statistics view by double-clicking a row in the Performance Profile view or selecting a method in the Performance Profile and clicking the Open Method Statistics button. For more information, see Identifying method performance characteristics. |
|
Memory Usage |
Graphically displays peak memory usage and current memory usage over time. For more information, see Using the Memory Usage graph. |
The Live Objects view displays information about the classes that the current application uses. This view shows which classes are instantiated, how many were created, how many are in memory, and how much memory the active objects are taking up.
The profiler updates the data in the Live Objects view continually while you profile the application. You do not have to refresh the view or keep focus on it to update the data.
To use the Live Objects view, you must enable memory profiling when you start the profiler. This is the default setting. If you close the Live Objects view and want to reopen it, open the drop-down list in the Profile view and select Watch Live Objects.
The following example shows the Live Objects view:
The following table describes the columns in the Live Objects view:
|
Column |
Description |
|---|---|
|
Class |
The classes that have instances in the currently running application. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Cumulative Instances |
The total number of instances of each class that have been created since the application started. |
|
Instances |
The number of instances of each class that are currently in memory. This value is always smaller than or equal to the value in the Cumulative Instances column. |
|
Cumulative Memory |
The total amount of memory, in bytes, that all instances of each class used, including classes that are no longer in memory. |
|
Memory |
The total amount of memory, in bytes, that all instances of each class currently use. This value is always smaller than or equal to the value in the Cumulative Memory column. |
You typically use the data in the Live Objects view to see how much memory is being used by objects. As objects are garbage collected, the number of instances and memory use decrease, but the cumulative instances and cumulative memory use increase. This view also tells you how memory is used while the application is running.
For more information on running and analyzing the results of garbage collection, see About garbage collection.
You limit the data in the Live Objects view by using the profiler filters. For more information, see About profiler filters.
The Memory Snapshot view displays information about the application's objects and memory usage at a particular time. Unlike the Live Objects view, the data in the Memory Snapshot view is not continually updated.
To use the Memory Snapshot view, you must enable memory profiling when you start the profiler. This is the default setting.
Create and view a memory snapshot
The profiler creates a memory snapshot and marks it with a timestamp. The profiler also implicitly triggers garbage collection before the memory snapshot is recorded.
The following example shows the Memory Snapshot view:
The following table describes the columns in the Memory Snapshot view:
|
Column |
Description |
|---|---|
|
Class |
The classes that had instances in memory at the time that you recorded the memory snapshot. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Instances |
The number of instances in memory of each class at the time that you recorded the memory snapshot. |
|
Memory |
The amount of memory, in bytes, that all instances of each class used at the time that you recorded the memory snapshot. |
You typically use a memory snapshot as a starting point to determine which classes you should focus on for memory optimizations or to find memory leaks. You do this by creating multiple memory snapshots at different points in time and then comparing the differences in the Loitering Objects or Allocation Trace views.
You can save memory snapshots to compare an application's state during a different profiling session. For more information, see Saving and loading profiling data.
When you double-click a row in the Memory Snapshot view, the profiler displays the Object References view. This view displays the stack traces for the current class's instances. You view the stack traces for the current class's instances in the Object References view. For more information about the Object References view, see Using the Object References view.
You can also limit the data in the Memory Snapshot view by using the profiler filters. For more information, see About profiler filters.
The Object References view displays stack traces for classes that were instantiated in the application.
To open the Object References view, double-click a class name in the Memory Snapshot or Loitering Objects views. The Object References view displays information about the selected class's instances.
The Object References view displays data in two tables: the Instances table and the Allocation Trace table.
The Instances table lists all objects that hold references to the current object. The number in parentheses after the class name is the total number of references to the current object. You cannot view the number of forward references for an object. If no objects hold references to the specified object, then there will be no objects listed in this table. This would not normally happen because that object should have been garbage collected if it had no references.
The following example shows the Instances table in the Object References view:
The following table describes the columns in the Instances table:
|
Column |
Description |
|---|---|
|
Instance |
The class of the object that holds a reference to the specified object. |
|
Property |
The property of the object that holds a reference to the specified object. For example, if you have object o with a property i, and assign that property to point to your button's label: o.i = myButton.label;That creates a reference to myButton.label from property i. |
|
id |
The reference ID of the object that holds the reference to the selected object. |
The Allocation Trace table shows the stack trace for the selected instance in the Instances table. When you select an instance in the Instances table, the profiler displays the call stack for that instance in the Allocation Trace table.
The following example shows the Allocation Trace table in the Object References view:
The following table describes the columns in the Allocation Trace table:
|
Column |
Description |
|---|---|
|
Method |
The top-level method in this table is the method that created the instance of the class that is listed in the Instances table. You can expand the method to show the stack trace of the method. This can help you determine where the call stack began. |
|
Location |
The file where the method is defined. |
|
Line |
The line number in the file. |
You can only view data in this table when you enable allocation traces when you start the profiler.
You can open the source code of the selected class by double-clicking a class in this table.
The Allocation Trace view shows which methods were called between two memory snapshots and how much memory was consumed during those method calls. To open the Allocation Trace view, you select two memory snapshots, and then click the View Allocation Trace button. For information on recording a memory snapshot, see Using the Memory Snapshot view.
The result of the memory snapshot comparison is a list of methods that Flash Player executed between the two memory snapshots. For each of these methods, the profiler reports the number of objects created in that method.
You can use this information to optimize performance. After you identify methods that create an excessive number of objects, you can optimize those hot spots.
To use the Allocation Trace view, you must enable allocation traces when you start the profiler. The default is disabled.
The following example shows the Allocation Trace view:
The following table describes the columns in the Allocation Trace view:
|
Column |
Description |
|---|---|
|
Method |
The method that was called during the snapshot interval. This column also contains the class whose instance called this method. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Cumulative Instances |
The number of objects instantiated in this method and all methods called from this method. |
|
Self Instances |
The number of objects instantiated in this method. This does not include objects that were instantiated in subsequent method calls from this method. |
|
Cumulative Memory |
The amount of memory, in bytes, used by the objects instantiated in this method and all methods called from this method. |
|
Self Memory |
The amount of memory, in bytes, used by the objects instantiated in this method. This does not include the memory used by objects that were instantiated in subsequent method calls from this method. |
When recording methods during sampling intervals, the profiler also records internal Flash Player actions. These actions show up in the method list in brackets and appear as [mouseEvent] or [newclass] or with similar names. For more information about internal Flash Player actions, see How the Flex profiler works.
To open the Object Statistics view, click a row in the Allocation Trace table. This view provides details about the objects that were created in the method that you selected. It also lets you drill down into the objects that were created in methods that were called from this method. For more information, see Using the Object Statistics view.
You limit the data in the Allocation Trace view by using the profiler filters. For more information, see About profiler filters.
The Object Statistics view shows the performance statistics of the selected group of objects. This view helps you identify which methods call a disproportionate number of other methods. It also shows you how much memory the objects instantiated in those method calls consume. You use the Object Statistics view to identify potential memory leaks and other sources of performance problems in your application.
To access the Object Statistics view, you select two memory snapshots in the Profile view and view the comparison in the Allocation Trace view. Then you double-click a row to view the details in the Object Statistics view.
There are three sections in the view:
The following example shows the method summary and the Self Instances and Callee Instances tables of the Object Statistics view:
The following table describes the fields in the Self Instances table in the Object Statistics view:
|
Column |
Description |
|---|---|
|
Class |
The classes that were instantiated only in the selected method. This does not include classes that were instantiated in subsequent calls from this method. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Self Instances |
The number of instances of this class that were created only in the selected method. This does not include instances that were created in subsequent calls from this method. |
|
Self Memory |
The amount of memory, in bytes, that is used by instances that were created only in the selected method. This does not include the memory used by instances that were created in subsequent calls from this method. |
The following example shows the Callee Instances table of the Object Statistics view:
The following table describes the fields in the Callee Instances table of the Object Statistics view:
|
Column |
Description |
|---|---|
|
Class |
The classes that were instantiated in the selected method. This includes classes that were instantiated in subsequent calls from this method. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Cumulative Instances |
The number of instances of this class that were created in the selected method and in subsequent calls from this method. |
|
Cumulative Memory |
The amount of memory, in bytes, that is used by instances that were created in the selected method and in subsequent calls from this method. |
The Performance Profile view is the primary view to use when doing performance profiling. It shows statistics such as number of calls, self-time, and cumulative time for the methods that are called during a particular sampling interval. You use this data to identify performance bottlenecks.
The process of performance profiling stores a list of methods and information about those methods that were called between the time you clear the performance data and the time you capture new data. This time difference is known as the interaction period.
To use the Performance Profile view, you must enable performance profiling when you start the profiler. This is the default setting.
Generate a performance profile
The time difference between when you clicked Reset Performance Data and the time you clicked Capture Performance Profile is the interaction period. If you do not click the Reset Performance Data button at all, then the performance profile includes all data captured from the time the application first started.
The following example shows the Performance Profile view:
The following table describes the columns in the Performance Profile view:
|
Column |
Description |
|---|---|
|
Method |
The name of the method and the class to which the method belongs. Internal actions executed by Flash Player appear as entries in brackets; for example, [mark] and [sweep]. You cannot change the behavior of these internal actions, but you can use the information about them to aid your profiling and optimization efforts. For more information on these actions, see How the Flex profiler works. |
|
Package |
The package that the class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Calls |
The number of times the method was called during the interaction period. If one method is called a disproportionately large number of times compared to other methods, then you can look to optimizing that method so that the execution time is reduced. |
|
Cumulative Time |
The total amount of time, in milliseconds, that all calls to this method, and all calls to subsequent methods, took to execute during the interaction period. |
|
Self Time |
The amount of time, in milliseconds, that all calls to this method took to execute during the interaction period. |
|
Avg. Cumulative Time |
The average amount of time, in milliseconds, that all calls to this method, and calls to subsequent methods, took to execute during the interaction period. |
|
Avg. Self Time |
The average amount of time, in milliseconds, that this method took to execute during the profiling period. |
If you double-click a method in the Performance Profile view, Flex displays information about that method in the Method Statistics view. This lets you drill down into the call stack of a particular method. For more information, see Identifying method performance characteristics.
You limit the data in the Performance Profile view by using the profiler filters. For more information, see About profiler filters.
You can save performance profiles for later use. For more information, see Saving and loading profiling data.
The Method Statistics view shows the performance characteristics of the selected method. You typically use the Method Statistics view to identify performance bottlenecks in your application. By viewing, for example, the execution times of a method, you can see which methods take a disproportionate amount of time to run. Then you can selectively optimize those methods.
For more information, see Using the Performance Profile view.
View method details in the Method Statistics view
There are three sections in the view:
The following example shows the method summary and the Callers and Callees tables of the Method Statistics view:
The following table describes the fields in the Callers table of the Method Statistics view:
|
Column |
Description |
|---|---|
|
Method |
The methods that called the method that appears in the summary at the top of this view. If this list is empty, the target method was not called by any methods that are not filtered out. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Cumulative Time |
The amount of time, in milliseconds, that each calling method, and all subsequent methods, spent executing. |
|
Self Time |
The amount of time, in milliseconds, that each calling method spent executing. This does not include methods called by subsequent methods. |
The following table describes the fields in the Callees table of the Method Statistics view:
|
Column |
Description |
|---|---|
|
Method |
The methods that were called by the method that is shown in the summary at the top of this view. If this list is empty, then the target method was not called by any methods that are not filtered out. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the file name that the class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the class is in the global package or the unnamed package. |
|
Cumulative Time |
The amount of time, in milliseconds, that each called method, and all subsequent methods, spent executing. |
|
Self Time |
The amount of time, in milliseconds, that each called method spent executing. This does not include methods called by subsequent methods. |
You can navigate the call stack while you attempt to find the performance bottlenecks by clicking the methods in either the Callers or Callees tables. If you double-click a method in these tables, the profiler displays that method's summary at the top of the Method Statistics view and then shows the callers and callees for the newly selected method in the two tables.
You can also use the Back, Forward, and Home profiler buttons to navigate the call stack.
You can limit the data in the Method Statistics view by using the profiler filters. For more information, see About profiler filters.
The Loitering Objects view shows you the differences between two memory snapshots of the application that you are profiling. The differences that this view shows are the number of instances of objects in memory and the amount of memory that those objects use. This is useful in identifying memory leaks. The time between two memory snapshots is known as the snapshot interval.
To open the Loitering Objects view, select two memory snapshots and click the Loitering Objects button. For information on recording a memory snapshot, see Using the Memory Snapshot view.
The following example shows the Loitering Objects view:
The following table describes the columns in the Loitering Objects view:
|
Column |
Description |
|---|---|
|
Class |
The classes that were created but not destroyed during the snapshot interval. |
|
Package |
The package that each class is in. If the class is not in a package, then the value of this field is the filename that this class is in. The number following the dollar sign is a unique ID for that class. If the Package field is empty, the object is in the global package or the unnamed package. |
|
Instances |
The number of instances created during the snapshot interval. This is the difference between the number of instances of each class that existed in the first snapshot and the number of instances of each class in the second snapshot. For example, if there were 22,567 strings in the first snapshot, and 22,861 strings in the second snapshot, the value of this field would be 294. |
|
Memory |
The amount of memory allocated during the snapshot interval. This is the difference between the amount of memory that the instances of each class used at the time the first snapshot was taken and the amount of memory that the instances of each class used at the time the second snapshot was taken. For example, if Strings took up 2,031,053 bytes in the first snapshot and 2,029,899 bytes in the second snapshot, the value of this field would be 1154 bytes. |
For more information on identifying memory leaks, see Locating memory leaks.
The Memory Usage graph shows you the memory used by the application that you are profiling. This value is different from the memory usage of the Flash Player and its browser. That is because this value does not include the profiler agent or the browser's memory usage. It consists only of the sum of the profiled application's live objects. As a result, if you compare the value of memory usage in this graph against the amount of memory the browser uses as shown in, for example, the Windows Task Manager, you will get very different results.
The following image shows the graph in the Memory Usage view:
The value for Current Memory is the same as the sum of the totals in the Live Objects view's Memory column, assuming that all filters are disabled.
The value for Peak Memory is the highest amount of memory that this application has used during the current profiling session.
The Memory Usage graph shows the application's memory for the last 100 seconds. You cannot configure this number, and you cannot save historical data for the chart.
If you close the Memory Usage graph and want to reopen it, click the drop-down menu button in the Profile view and select Memory Usage.