Optimizeit Profiler Overview

Source: Internet
Author: User
Tags count manual garbage collection header interface reference thread cpu usage

Optimizeit Profiler Overview















This article introduces some of the main features of Optimizeit Profiler to make you have a brief understanding of it. For more information, check the Optimizeit Profiler user's manual. You can click the main menu Info|help from Optimizeit Profiler to see all of your usage documents.

Please feel free to contact Borland Technical support for any problems in use.

Start the application







Optimizeit Profiler collects useful information by running an application on a stand-alone virtual machine.

Before running a Java program, you need to install a Java virtual machine. Optimizeit Profiler The default configuration is JDK 1.4 or 1.4.1. If you want to use another virtual machine, you can see how the Optimizeit Profiler User's manual adds additional virtual machine parts.

Optimizeit Profiler can be used to test any type of Java program: Standard application, Application applet, Servlets, JSP,EJB, and so on. This article uses a demo program that is included in the Optimizeit Quichktour directory. All the demonstrations in this article can be completed.

1, open Optimizeit Profiler;

2, if you are open for the first time, will automatically pop-up Edit Settings window. If it is already open, you can select new setting from the File menu and bring up the Edit Settings window.

3, select application in the Program type box.

4. Click the "Browse ..." button to the right of program main class or Jar file.

5, locate the \doc\profiler\quicktour\quicktourapp.jar file, and then click Open.

6, Profiler will return to the Settings window, and automatically brought into the program's workspace and Classpath. In the Source Path box, click Change ... Button.

7. In the Source Path Chooser window, select the \doc\profiler\quicktour directory under the installation path; Select \doc\profiler\quicktour\ Quicktourapp.jar the file and then click the Down button in the window to add it to the source path section.

8, click OK to add to the path in the source file. The dialog box is set up as follows:





9, click the Start Now button.

10, the editing window will automatically close, and Optimizeit Profiler automatically load the case program.

Using Memory Profiler







When you are using this tool for the first time, Optimizeit automatically opens to the Memory Watch window:









The memory monitor lists all the classes in the program being tested and counts the number of instances of each class in real time. Memory monitor is turned on by default in heap mode, which allows you to see the creation and revocation of objects. The following steps will demonstrate how to control the memory monitor to make it easier to analyze the memory usage of the program being tested:







1, click the instance count of the Memory monitor table header. This will be sorted in descending order according to the number of instances allocated.







2. In the filters window below the Memory Monitor window, enter the class you want to observe, enter the java.awt.* in the Filters box, and press ENTER, which will only display information about the java.awt class.







3, we can see that the number of instances of many classes either increases or decreases. The increase is due to an instance generation, which is reduced because garbage collection is at work. If you want to see the creation of a temporary object, you can select the Disable garbage collector button at the bottom right of the window so that Optimizeit will consistently display the number of all instances.















4, select the Java.awt.Color class, and then click the Allocation backtrace button to enter allocation BackTrace mode. You can also double-click on the class name to enter. The BackTrace information shows the information that the method in each instance of the class is invoked.







5. In the allocation BackTrace view, you can view information in two ways:







L Hierarchical View Hierarchical mode displays the tree chart by default. In a tree diagram, a method may appear in more than one place, in which the method is invoked. However, in the graphical view, the methods represented by the nodes are displayed only once. It can still have multiple parent paths.







L in the aggregated view chart mode each node will use a line to connect, or to the border only one side wired. Starting with multiple child nodes, each line corresponds to a method that invokes this method. Unlike the tree, there may be loops in the chart. The chart display helps with tracing. If you want to find out how a statement is invoked, the chart will be a quick and easy way to quickly find out what the parent-child relationship is.







You can use buttons to switch between the two ways.







6. Select the Eventdispatchthread.run () line and click the plus sign on the left to expand. Click the node with the largest ratio until the Graphics2d.fill3drect () row is expanded.















7. Double-click the Graphics2d.fill3drect () line to display the source code for the color instance assignment. The source code will help you understand why the drawing path class produces so many instances. The Fill3drect method allocates a number of colors because it invokes the Color.brighter () method and Color.darker () method.







Note: If you are the first user, you may not have the source code path in the diagram.







With a memory monitor, you can help create fewer temporary objects. Although temporary objects are often quickly refactored, it can lead to more frequent garbage collection. For most Java virtual machines, running any Java program can delay hundreds of milliseconds when the garbage collector is busy. If too many temporary objects are used, this can cause the user to feel that the program is reacting slowly.







The memory monitor also helps to understand why the garbage collector does not deconstruct these objects. For example, it will help us understand that when an object is no longer in use, it is actually being destructor by the garbage collector. The following steps describe using a memory monitor to determine the generation of an instance and how to be collected by the garbage collector.







1, click the icon to return to heap mode.







2, in order to display only image-related related classes, you can clear the contents of the Fileters box, and then enter *image*, and then press ENTER.







3, select the Javax.swing.ImageIcon line, and then click the icon (show instance and reference map), showing the example diagram:















A character description of the instance is displayed above the window.







The middle section of the window shows the selected instance object reference and an instance derived from the object. In this case, the garbage collector is not collected because the ImageIcon object is referenced.







The bottom section of the window shows the allocation path for the selected instance of the middle window. You can see that the instance is assigned by the constructor Quicktourapp. This image is the Optimizeit logo that is displayed in the middle of the program as a background.







Memory leaks are often the result of referencing objects continuously in the program's run, so they still occupy resources. Because of this, if you can navigate to objects that use a large number of references, then you can navigate to the source of the memory leak caused by the object consuming resources. To be able to navigate to objects that use a large number of references, and to track these references:







1, open memory leak detection, click the Memory Leak monitoring button.







2. To look for possible memory leaks, profiler needs to compare the status of a series of heaps. You can create it by clicking the Save Heap Status button.







3, let the Quicktour program run more than 15 seconds.







4. Click the Save Heap Status button again to record a new heap state record. You can create multiple heap state records.







5, from the heap state table for the initial state to be compared, the to heap states to be compared with the from heap. Each time a record in the From Heap state table is selected, only the records after that record can be selected in the to heap.







6. The middle portion of the window shows the newly referenced resource after the heap state record is compared. The count value is the number of incrementing references for this object. You can sort by clicking the Count table header. You can select a reference to see all the object references in the heap state that are related to this object reference.















7, the object in the diagram will have connectors or boundaries. Starting from the root node, there is a corresponding reference. Move the mouse over the node to display the number of new references and the node call ToString (). Move the mouse over the last node, and the instance variable name of the reference will be displayed.







8. There are two scroll bars above the figure:







Use the verbosity scroll bar to adjust the level of detail for the chart display.







Use the zoom scroll bar to adjust the size of the chart display.







All the different colors represent different meanings:







L The Blue node is an indirect reference handle. Represents a reference that is not a direct reference.







L The Red node is a reference handle. The representation is a direct reference.







The more references to the L node, the darker the color.







L Subsequent connections appear as green lines. Subsequent connections are a higher-level reference for an object in the reference. All subsequent connections have a blue border. A forward connection in a reference hierarchy is a reference to a subsequent connection.







L When a node is selected, the references associated with this node will flicker.







L Select a node and right-click to open the selected node in a new instance.







Using CPU Profiler







Memory monitors help minimize the use of objects. CPU Monitor will help you understand the time that the object is being used. CPU monitor can be viewed as a recording device in the Java Virtual machine. The following steps describe how to give the response time and CPU usage of the tested program.







1, click the CPU Monitor button to switch to the CPU monitoring interface.







2, click the Start CPU Monitoring button to start recording the CPU utilization of the program.







3, let the program run for a period of time (such as three seconds or more).







4, click the Stop CPU Monitoring button to stop logging. CPU monitor shows the CPU usage information that has been recorded.















5, if not selected, please select the tree format, see the same information.







6, click the Drop-down box above the window to show the virtual machine currently running all the threads.















7. Select the thread of awt-eventqueue-0 thread, which is used by AWT to process time, such as repaint event.







8, expand Eventdispatchthread.pumponeevent () line.







9, click the plus sign to the left of Eventqueue.dispatchevent () to expand all methods until the Jcomponent.paintwithbuffer () method is expanded. The icon in front of the line means:







Indicates that the method is called directly by another method.







Represents the method with the longest execution time.







In this example, the awt-eventqueue-0 thread has been working with the repaint event.







10, select Jcomponent.paintwithbuffer () line. If you move the mouse over the method called by Jcomponent.paintwithbuffer (), the proportion of time used by the method in Jcomponent.paintwithbuffer () is displayed.







11. If you want to analyze that thread is idle, CPU monitor can display both CPU usage and usage time. Click Inspector (Under Tool menu) to open the Inspector dialog box.















12, do not select Ony record CPU usage, and then close the window. Use this feature to select the buffering policy, which displays the CPU pure usage information by default.







View Virtual Machine Information







Optimizert provides real-time display of data-related high standard performance testing information. With this feature, you can see whether the performance problem is related to CPU or memory or to both.







Click to switch to virtual machine mode.







In this mode, four types of performance icons are displayed, and each type of diagram describes the different activity information for the virtual machine:















Heap diagram: The red line in the upper-left corner indicates the size of the stack currently needed by the program being tested, and the green indicates the size of the stack actually used by the program being tested.







Garbage Collection Chart: Displays the current garbage collector activity in the upper corner of the graph, showing the proportion of garbage collection time to total time. Helps you observe the frequency and time that the garbage collector uses.







Thread diagram: The red line in the lower-left corner indicates the currently running thread, and green means that most threads use the CPU.







Class diagram: The figure in the lower-right corner shows the number of classes currently loaded by the virtual machine.







View Test Results







Optinizeit contains a number of ways to view test results, as in the case of the real-time monitoring method above, to keep all the information in a snapshot or report, so that you can analyze the results later or compare it to another result.







For example, you can output a test result as an HTML file.







1. When the demo program is still running, click CPU Monitor to return to the CPU monitor interface.







2, in order to view all the information, fully expand all the methods. Make sure that the information you need is displayed in a hierarchical view because the output does not contain a chart.







3, click the Output icon to open the Output window:















4. Fill in the title, check the path in the filename box is valid, and select Output as. html format.







5, click Ok,optimizeit will output the results to the defined. html file, and then automatically open.















Now you can share your test results.















This article is just an overview of Optimizeit Profiler. If you want to learn more about Optimizeit, check the Optizeit Profiler user's Guide.















Translation: wyingquan@hotmail.com time: 2004-11-5
















Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.