使用 JRockit 飞行记录器( JRockit Flight Recorder)

Although the Flight Recorder performs its tasks in the background during run time, you can control certain aspects of it from the command line and, if you have installed Oracle JRockit Mission Control 4.0 (or later) Client, from the Flight Recorder GUI. Your command-line control over the Flight Recorder is limited to starting and stopping a recording, setting some recorder and recording parameters, dumping recordings, and spot-checking recordings. You can also enable or disable the Flight Recorder from the command line.

This chapter includes these sections:

5.1 Types of Recordings

With the Flight Recorder, you can make two kinds of recordings:

5.1.1 Continuous Recording

A Continuous Recording is a background recording that continuously saves data to a rotating buffer. To access the data from a Continuous Recording, you create a dump of the buffer. When creating the dump, you can specify the time period you want to dump and the location of the resulting Flight Recorder file. The Flight Recorder will gather as much data as possible from a Continuous Recording and save it to the file.

If the location is not specified, the resulting Flight Recorder file will be located at default location (see Chapter 4, "Storage Modes").

5.1.2 Profiling Recording

A Profiling Recording occurs when the Flight Recorder is asked for future data, just like the JRockit Runtime Analyzer was used in previous releases of JRockit Mission Control. You can specify what data to gather, the length of the recording, and the location of the resulting Flight Recorder file.

  • If you do not specify the data you want gathered, then default data is collected.

  • If you do not specify the length of the recording, then Flight Recorder will continue to record data until you stop the process.

  • If you do not specify the location of the Flight Recorder file, then the resulting file will be located at default location (see Chapter 4, "Storage Modes").

5.2 Creating a Flight Recording

By default, when a Java application is running, the Flight Recorder is enabled but nothing is being recorded. You can start a Continuous Recording and set its parameters by using command-line options at startup. The parameters include buffer size, repository location, and Continuous Recording properties. This section describes procedures for the following tasks:

5.2.1 Starting the Continuous Recording

To start a Continuous Recording, use this start-up option:

-XX:+FlightRecorderOptions=defaultrecording=true

5.2.2 Setting Flight Recorder Options

To set Flight Recorder options, start the application as you normally would but include the -XX:FlightRecorderOptions=; for example:

java -XX:FlightRecorderOptions=<param> [option] [option] ... myApp

Where:

  • -XX:FlightRecorderOptions=<param> sets the recording parameters, as described in "-XX:FlightRecorderOptions" in the Oracle JRockit Command Line Reference.

  • [option] is any other command-line option you want to run. See the Oracle JRockit Command Line Reference for a list of all valid command-line options.

  • myApp is the Java application you are starting.

5.2.3 Disabling the Flight Recorder

If, for some reason, you do not want the Flight Recorder enabled while your application runs, disable it by using this start-up command:

java -XX:-FlightRecorder [option] [option] ... myApp

Where:

  • [option] is any other command-line option you want to run. See the Oracle JRockit Command Line Reference for a list of all valid command-line options.

  • myApp is the Java application you are starting.

Note:

If you disable the Flight Recorder, you cannot re-enable it during run time. You will need to restart your Java application as described in Section 5.2.2, "Setting Flight Recorder Options".

5.2.4 Starting a Profiling Recording

To start a Profiling Recording—that is, one you can view with the Flight Recorder GUI in JRockit Mission Control—you need to execute the -XX:StartFlightRecording command at application startup or execute the diagnostic command start_flightrecording during run time.

5.2.4.1 Starting a Profiling Recording at Application Startup

To start a Profiling Recording at startup, include the command-line option -XX:StartFlightRecording when you start the application; for example:

java -XX:StartFlightRecording=<param> [option] ... myApp

Where:

  • -XX:StartFlightRecording=<param> starts the recording with the parameters specified by <param>, as described in "-XX:StartFlightRecording" in the Oracle JRockit Command Line Reference.

  • [option] is any other command-line option you want to run. See the Oracle JRockit Command Line Reference for a list of all valid command-line options.

  • myApp is the Java application you are starting.

5.2.4.2 Starting a Profiling Recording During Run Time

You can start a Profiling Recording on a running Oracle JRockit JVM process by using the diagnostic command start_flightrecording. You can issue this command by using one of the following mechanisms:

5.2.4.2.1 The jrcmd Utility

To issue the command by using jrcmd, at the command line, type:

jrcmd <pid> start_flightrecording <param>

Where:

For more information on using jrcmd, see "Running Diagnostic Commands" in the Oracle JRockit JDK Tools Guide.

5.2.4.2.2 A Ctrl-Break Handler

With this tool, you press the Ctrl and Break keys simultaneously to execute the command. For Ctrl-Break to work, you must specify the command start_flightrecording with appropriate parameters in the ctrlhandler.act file. Before attempting to use a Ctrl-Break handler, it is recommended you read more about it in "Running Diagnostic Commands" in the Oracle JRockit JDK Tools Guide.

5.2.4.2.3 JRockit Mission Control Console

You can issue start_flightrecording from the Diagnostic Commands tab on the JRockit Mission Control Management Console. For more information, see the online help for the JRockit Mission Control Diagnostic Commands plug-in.

5.3 Using the Flight Recorder

Once a recording is in progress, you can perform certain tasks with the Flight Recorder during run time by using diagnostic commands similar to those described in Section 5.2.4.2, "Starting a Profiling Recording During Run Time". Specifically, you can check the status of a recording, dump a recording to a file, and stop an in-process recording. This section describes how to perform these tasks in the following sections:

5.3.1 Checking the Status of a Recording

Checking a recording prints the details of the recording at the time the command was issued. These details might include the duration of the recording, the event settings, and so on.

You can check the status of a recording by using the diagnostic command check_flightrecording with one of these invocation tools:

5.3.1.1 Checking Recording Status from the Command Line with jrcmd

The easiest way to check a flight recording is from the command line by using the jrcmd utility.

To check the status of a flight recording from the command line:

At the command line, type:

jrcmd <pid> check_flightrecording <param>

Where:

  • <pid> is the process identifier.

  • <param> is any parameter listed in Table 5-1.

5.3.1.2 Checking the Recording Status by Using a Ctrl-Break Handler

You can also check a flight recording by using a Ctrk-Break handler.

To check the status of a flight recording by using a Ctrl-Break handler:

  1. Add the Ctrl-Break handler check_flightrecording, with appropriate parameters (see Table 5-1), to the application's ctrlhandler.act file, as shown here:

    check_flightrecording name=myRecording verbose=true
  2. When you want to check the recording during run time, press the Ctrl and Break keys simultaneously.

5.3.1.3 Checking the Recording Status from the Mission Control Console

If you are running Oracle JRockit Mission Control 4.0 Client, you can check the status of a flight recording by executing the check_flightrecording command from the Diagnostic Command tab on the Mission Control Console.

Note:

This procedure assumes you are running JRockit Mission Control 4.0 Client.

To check the status of a flight recording from the Mission Control Console:

  1. With Mission Control Client running, click Advanced then select the Diagnostic Commands tab.

  2. In the Diagnostic Command list, select check_flightrecording.

  3. In the Command panel, enter the necessary parameters, as described in Table 5-1.

5.3.1.4 check_flightrecording Command Parameters

Table 5-1 describes the valid parameters for check_flightrecording.

Table 5-1 check_flightrecording Command Parameters

Parameter Description
name=<string>

The recording identifier as a string. If you use this parameter, you do not have to specify a value for recording=.

recording=<id>

The recording identifier as a number. If you use this parameter, you do not have to specify a value for name=.

verbose=<true | false> 

Whether or not to enable verbose output.

Default: false

5.3.2 Dumping a Recording

Dumping a recording moves all recording data that you have so far collected to a dump file that you can store on a disk for subsequent review.

You can check the status of a recording by using the diagnostic command check_flightrecording with one of these invocation tools:

5.3.2.1 Dumping a Recording from the Command Line with jrcmd

The easiest way to dump a flight recording is from the command line by using the jrcmd utility.

To dump a flight recording from the command line:

At the command line, type:

jrcmd <pid> dump_flightrecording <param>

Where:

  • <pid> is the process identifier.

  • <param> is any parameter listed in Table 5-2.

5.3.2.2 Dumping a Recording by Using a Ctrl-Break Handler

You can also check a flight recording by using a Ctrk-Break handler.

To check the status of a flight recording by using a Ctrl-Break handler:

  1. Add the Ctrl-Break handler dump_flightrecording, with appropriate parameters (see Table 5-2), to the application's ctrlhandler.act file, as shown here:

    dump_flightrecording name=myRecording copy_to_file=myDump
  2. When you want to check the recording during run time, press the Ctrl and Break keys simultaneously.

5.3.2.3 Dumping a Recording from the Mission Control Console

If you are running Oracle JRockit Mission Control 4.0 Client, you can dump a flight recording by executing the dump_flightrecording command from the Diagnostic Command tab on the Mission Control Console.

Note:

This procedure assumes you are running JRockit Mission Control 4.0 Client.

To dump a flight recording from the Mission Control Console:

  1. With Mission Control Client running, click Advanced then select the Diagnostic Commands tab.

  2. In the Diagnostic Command list, select dump_flightrecording.

  3. In the Command panel, enter the necessary parameters, as described in Table 5-2.

5.3.2.4 dump_flightrecording Parameters

Table 5-2 describes the valid parameters for check_flightrecording.

Table 5-2 dump_flightrecording Parameters

Parameter Description
name=<string>

The recording identifier as a string. If you use this parameter, you do not have to specify a value for recording=.

recording=<id>

The recording identifier as a number. If you use this parameter, you do not have to specify a value for name=.

copy_to_file=<string> 

The name of the file to which you want the data dumped. You must include the path to the file per the respective operating system path standard.

compress_copy=<true | false> 

Whether or not you want to Gzip the file on the disk.

Default: false

5.3.3 Stopping a Recording

Generally, you will set the duration of a specific recording when you start the recording by using the -XX:StartFlightRecording:duration= command-line option or start_flightrecording duration= diagnostic command. Sometimes, however, you might want to stop a recording mid-process and not wait for the specified time limit to expire; or, if you have not set a duration (for example when making a Profiling Recording), you might feel that you have collected enough information and want to stop the recording. You can stop a recording at any time by using the stop_flightrecording diagnostic command.

As with the previously described diagnostic commands, you can invoke stop_flightrecording from any of these tools:

Note:

Do not stop or remove the recording with the ID 0. Doing this effectively destroys the "always-on" functionality of the Flight Recorder.

5.3.3.1 Stopping a Recording from the Command Line with jrcmd

The easiest way to stop a flight recording is from the command line by using the jrcmd utility.

To stop a flight recording from the command line:

At the command line, type:

jrcmd <pid> stop_flightrecording <param>

Where:

  • <pid> is the process identifier.

  • <param> is any parameter listed in Table 5-3.

5.3.3.2 Stopping a Recording by Using a Ctrl-Break Handler

You can also check a flight recording by using a Ctrk-Break handler.

To check the status of a flight recording by using a Ctrl-Break handler:

  1. Add the Ctrl-Break handler stop_flightrecording, with appropriate parameters (see Table 5-2), to the application's ctrlhandler.act file, as shown here:

    stop_flightrecording name=myRecording discard=false
  2. When you want to check the recording during run time, press the Ctrl and Break keys simultaneously.

5.3.3.3 Stopping a Recording from the Mission Control Console

If you are running Oracle JRockit Mission Control 4.0 Client, you can stop a flight recording by executing the stop_flightrecording command from the Diagnostic Command tab on the Mission Control Console.

Note:

This procedure assumes you are running JRockit Mission Control 4.0 Client.

To stop a flight recording from the Mission Control Console:

  1. With Mission Control Client running, click Advanced then select the Diagnostic Commands tab.

  2. In the Diagnostic Command list, select stop_flightrecording.

  3. In the Command panel, enter the necessary parameters, as described in Table 5-3.

5.3.3.4 stop_flightrecording Parameters

Table 5-3 describes the valid parameters for stop_flightrecording.

Table 5-3 stop_flightrecording Parameters

Parameter Description
name=<string>

The recording identifier as a string. If you use this parameter, you do not have to specify a value for recording=.

recording=<id>

The recording identifier as a number. If you use this parameter, you do not have to specify a value for name=.

discard=<true | false> 

True discards the recording data; in other words, it does not produce a data file.

Default: false

copy_to_file=<string> 

The name of the file to which you want the data dumped, including the file path.

compress_copy=<true | false> 

Whether or not you want to Gzip the .jfr file on the disk.

Default: false

 

淘宝电器城现在做得真的是很好,买电器很实惠

http://pindao.huoban.taobao.com/tms/channel/electric.htm?pid=mm_24766140_0_0&eventid=101333

http://www.tmall.com/go/chn/tbk_channel/tmall_new.php?pid=mm_15321926_0_0&eventid=101334

你可能感兴趣的:(order)