# Copyright 2013, 2014 Azul Systems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# Please contact Azul Systems, Inc., 1173 Borregas Avenue, Sunnyvale, CA 94089
# USA or visit www.azulsystems.com if you need additional information or have
# any questions.

ZVRobot README File

ZVRobot captures snapshots of the performance and other relevant information
for a running Zing VM and your application. The collected information is stored
in files that you can browse using a web browser.

1. Starting the Zing VM to enable connection by ZVRobot

To enable ZVRobot to connect to the Zing VM, you will need to add this command
line option when you start the Zing VM:

  -XX:ARTAPort=<a port not already in use>

2. ZVRobot.prop Property File

To begin using ZVRobot, you will need to modify the ZVRobot.prop file to
specify the host where you started the Zing VM and the port that you specified
on the command line with the -XX:ARTAPort option. You can set the interval
between collections and the duration of the metric collection using the 
ZVRobotVars.SECONDS and ZVRobotVars.COUNT variables in the ZVRobot.prop file.
When modifying the ZVRobot.prop file, you can also select the metrics and 
information that you would like to collect.  

3. Running ZVRobot

ZVRobot is packaged as a Java program in ZVRobot*.jar. A sample script to launch
ZVRobot is provided, startsample.sh. In the script, you will need to change the
JAVA_HOME environment variable to point to a Java installed on the machine 
where you are running ZVRobot. ZVRobot can be run anywhere as long as the Zing
VM's machine (IP address) and port are accessible. To run ZVRobot from the
command line, simply type:

  java -jar ZVRobot-<version>.jar any ZVRobot.prop

The "<version>" is the version of the ZVRobot and Zing VM. Please try to use a
version of ZVRobot that is the same as the version of the Zing VM.

The first parameter to the program, in this case, the "any" parameter, is the
name of the directory where ZVRobot stores its collected information. The value
"any" is interpreted by ZVRobot to mean that ZVRobot should create a new
directory with a name that has the format:

  ZVRobot_<date>_<time>_<milliseconds>_dir

The second parameter to the program is the ZVRobot.prop property file.

You can use Ctrl-C to terminate a running ZVRobot or you can specify how many
samples you would like to collect by using the ZVRobotVars.COUNT variable in the
ZVRobot.prop file. If not specified, the value of ZVRobotVars.COUNT defaults to
-1 which is interpreted to mean that ZVRobot should collect an infinite number
of samples. To stop ZVRobot's collection of data when you are running ZVRobot 
from the command line, just use ctrl-c.

Disk-usage note: If ZVRobot is configured to fetch samples at a high frequency
in a long-running session, the volume of collected data may grow to occupy a
large amount of disk-space. In such a scenario, you can avoid the disk space
issue by limiting the types of metrics (URLs in ZVRobot.prop) to collect to a
reasonable minimum, that is, only collect those metrics of greatest interest.

4. ZVRobot Output

ZVRobot writes its output to a directory with the format specified in the
previous section. Point your browser to the directory and load the file:

  ZVRobot_<date>_<time>_<milliseconds>_dir/AzulZVRobotIndex.html

This page is a summary of the names, sampling interval, and number of samples
collected for each of the metrics and information that you specified in the 
ZVRobot.prop file. The format for each entry is:

  Manifest.Frame.<metric name>.html (http://host:port/<metric url>)
  interval: <ZVRobotVars.SECONDS>
  total count: <total number of samples collected>

Select the metric (Manifest.Frame.<metric name> is a hyperlink) for which you
are interested in obtaining more information. A new tab (or window) will open
displaying the first collected metric and an index on the left hand side of 
the web page for each of the metric pages of that same type. You can select the
date/time (a hyperlink) to view the sample taken at that time. The information
will be displayed in the right frame in the same window or select the "(new
window)" link to view the information in a new tab (or window).
