Command Line Comparison Executable

## Command Line Comparison Executable |

| The command line comparison executable can be used to generate comparisons from a number of saved snapshot. For more information please consult the overview.

| The comparison executable is named `jpcompare.exe` on Windows and `jpcompare` on Unix-based operating systems and is located in the `bin` directory of a JProfiler installation. If you execute it with the -help option, you will get help on the available comparison names and comparison options:
      Usage: jpcompare "snapshot file"[,"snapshot file",...] [global options]
                    "comparison name" [options] "output file"
                    "comparison name" [options] "output file" ...

      where "snapshot file" is a snapshot file with a .jps, .hprof, or .dat extension
            [global options] is a list of options in the format -option=value
            "comparison name" is one of the comparison names listed below
            [options] is a list of options in the format -option=value
            "output file" is the output file for the export

      Global options:
          -outputdir=[output directory]
              Base directory to be used when the output file for a comparison is a
              relative file.
          -ignoreerrors=true|false
              Ignore errors that occur when options for a comparison cannot be set
              and continue with the next comparison. The default value is "false",
              i.e. the export is terminated, when the first error occurs.
          -sortbytime=false|true
              Sort the specified snapshot files by modification time. The default
              value is false.
          -listfile=[filename]
              Read a file that contains the paths of the snapshot files, one
              snapshot file per line.

      Available comparison names and options:
      * Objects
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -viewfilters=[comma-separated list]
              Sets view filters for the export. If you set view filters, only the
              specified packages and their sub-packages will be displayed by the
              exported view.
          -objects=all|recorded|heapwalker
              Compare all objects (JVMTI only) or recorded objects, or objects in
              the heap walker. The default is all objects for .jps files and
              heapwalker for HPROF files.
          -liveness=live|gc|all
              Selects the liveness mode for the export, i.e. whether to display live
              objects, garbage collected objects or both. The default value is live
              objects.
          -aggregation=class|package|component
              Selects the aggregation level for the export. The default value is
              classes.

      * AllocationHotSpots
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -viewfilters=[comma-separated list]
              Sets view filters for the export. If you set view filters, only the
              specified packages and their sub-packages will be displayed by the
              exported view.
          -classselection
              Calculate the comparison for a specific class or package. Specify a
              package with a wildcard, like 'java.awt.*'.
          -liveness=live|gc|all
              Selects the liveness mode for the export, i.e. whether to display live
              objects, garbage collected objects or both. The default value is live
              objects.
          -aggregation=method|class|package|component
              Selects the aggregation level for the export. The default value is
              methods.
          -filteredclasses=separately|addtocalling
              Selects if filtered classes should be shown separately or be added to
              the calling class. The default value is to show filtered classes
              separately.

      * AllocationTree
        options:
          -format=html|xml
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -viewfilters=[comma-separated list]
              Sets view filters for the export. If you set view filters, only the
              specified packages and their sub-packages will be displayed by the
              exported view.
          -classselection
              Calculate the comparison for a specific class or package. Specify a
              package with a wildcard, like 'java.awt.*'.
          -liveness=live|gc|all
              Selects the liveness mode for the export, i.e. whether to display live
              objects, garbage collected objects or both. The default value is live
              objects.

      * HotSpots
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -viewfilters=[comma-separated list]
              Sets view filters for the export. If you set view filters, only the
              specified packages and their sub-packages will be displayed by the
              exported view.
          -firstthreadselection
              Calculate the comparison for a specific thread or thread group.
              Specify thread groups like 'group.*' and threads in specific thread
              groups like 'group.thread'. Escape dots in thread names with
              backslashes.
          -secondthreadselection
              Calculate the comparison for a specific thread or thread group. Only
              available if 'firstthreadselection' is set. If empty, the same value
              as for 'firstthreadselection' will be used. Specify thread groups like
              'group.*' and threads in specific thread groups like 'group.thread'.
              Escape dots in thread names with backslashes.
          -threadstatus=all|running|waiting|blocking|netio
              Selects the thread status for the export. The default value is the
              runnable state.
          -aggregation=method|class|package|component
              Selects the aggregation level for the export. The default value is
              methods.
          -differencecalculation=total|average
              Selects the difference calculation method for call times. The default
              value is total times.
          -filteredclasses=separately|addtocalling
              Selects if filtered classes should be shown separately or be added to
              the calling class. The default value is to show filtered classes
              separately.

      * CallTree
        options:
          -format=html|xml
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -viewfilters=[comma-separated list]
              Sets view filters for the export. If you set view filters, only the
              specified packages and their sub-packages will be displayed by the
              exported view.
          -firstthreadselection
              Calculate the comparison for a specific thread or thread group.
              Specify thread groups like 'group.*' and threads in specific thread
              groups like 'group.thread'. Escape dots in thread names with
              backslashes.
          -secondthreadselection
              Calculate the comparison for a specific thread or thread group. Only
              available if 'firstthreadselection' is set. If empty, the same value
              as for 'firstthreadselection' will be used. Specify thread groups like
              'group.*' and threads in specific thread groups like 'group.thread'.
              Escape dots in thread names with backslashes.
          -threadstatus=all|running|waiting|blocking|netio
              Selects the thread status for the export. The default value is the
              runnable state.
          -aggregation=method|class|package|component
              Selects the aggregation level for the export. The default value is
              methods.
          -differencecalculation=total|average
              Selects the difference calculation method for call times. The default
              value is total times.

      * TelemetryHeap
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -minwidth=[number of pixels]
              Minimum width of the graph window in pixels. The default value is 800.
          -minheight=[number of pixels]
              Minimum height of the graph window in pixels. The default value is
              600.
          -valuetype=current|maximum|bookmark
              Type of the value that is calculated for each snapshot. Default is the
              current value.
          -bookmarkname
              If valuetype is set to 'bookmark', the name of the bookmark for which
              the value should be calculated.
          -measurements=maximum,free,used
              Measurements that are shown in the comparison graph. Concatenate
              multiple values with commas. The default value is 'used'.
          -memorytype=heap|nonheap
              Type of the memory that should be analyzed. Default is 'heap'.
          -memorypool
              If a special memory pool should be analyzed, its name can be specified
              with this parameter. The default is empty, i.e. no special memory
              pool.

      * TelemetryObjects
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -minwidth=[number of pixels]
              Minimum width of the graph window in pixels. The default value is 800.
          -minheight=[number of pixels]
              Minimum height of the graph window in pixels. The default value is
              600.
          -valuetype=current|maximum|bookmark
              Type of the value that is calculated for each snapshot. Default is the
              current value.
          -bookmarkname
              If valuetype is set to 'bookmark', the name of the bookmark for which
              the value should be calculated.
          -measurements=total,nonarrays,arrays
              Measurements that are shown in the comparison graph. Concatenate
              multiple values with commas. The default value is 'total'.

      * TelemetryClasses
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -minwidth=[number of pixels]
              Minimum width of the graph window in pixels. The default value is 800.
          -minheight=[number of pixels]
              Minimum height of the graph window in pixels. The default value is
              600.
          -valuetype=current|maximum|bookmark
              Type of the value that is calculated for each snapshot. Default is the
              current value.
          -bookmarkname
              If valuetype is set to 'bookmark', the name of the bookmark for which
              the value should be calculated.
          -measurements=total,filtered,unfiltered
              Measurements that are shown in the comparison graph. Concatenate
              multiple values with commas. The default value is 'total'.

      * TelemetryThreads
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -minwidth=[number of pixels]
              Minimum width of the graph window in pixels. The default value is 800.
          -minheight=[number of pixels]
              Minimum height of the graph window in pixels. The default value is
              600.
          -valuetype=current|maximum|bookmark
              Type of the value that is calculated for each snapshot. Default is the
              current value.
          -bookmarkname
              If valuetype is set to 'bookmark', the name of the bookmark for which
              the value should be calculated.
          -measurements=total,runnable,waiting,netio,waiting
              Measurements that are shown in the comparison graph. Concatenate
              multiple values with commas. The default value is 'total'.

      * ProbeHotSpots
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -viewfilters=[comma-separated list]
              Sets view filters for the export. If you set view filters, only the
              specified packages and their sub-packages will be displayed by the
              exported view.
          -firstthreadselection
              Calculate the comparison for a specific thread or thread group.
              Specify thread groups like 'group.*' and threads in specific thread
              groups like 'group.thread'. Escape dots in thread names with
              backslashes.
          -secondthreadselection
              Calculate the comparison for a specific thread or thread group. Only
              available if 'firstthreadselection' is set. If empty, the same value
              as for 'firstthreadselection' will be used. Specify thread groups like
              'group.*' and threads in specific thread groups like 'group.thread'.
              Escape dots in thread names with backslashes.
          -threadstatus=all|running|waiting|blocking|netio
              Selects the thread status for the export. The default value is the
              runnable state.
          -aggregation=method|class|package|component
              Selects the aggregation level for the export. The default value is
              methods.
          -differencecalculation=total|average
              Selects the difference calculation method for call times. The default
              value is total times.
          -probeid
              The internal ID of the probe that should be exported. Run "jpexport
              -listProbes" to list all available built-in probes and for an
              explanation of custom probe names.

      * ProbeTelemetry
        options:
          -format=html|csv
              Determines the output format of the exported file. If not present, the
              export format will be determined from the extension of the output
              file.
          -minwidth=[number of pixels]
              Minimum width of the graph window in pixels. The default value is 800.
          -minheight=[number of pixels]
              Minimum height of the graph window in pixels. The default value is
              600.
          -valuetype=current|maximum|bookmark
              Type of the value that is calculated for each snapshot. Default is the
              current value.
          -bookmarkname
              If valuetype is set to 'bookmark', the name of the bookmark for which
              the value should be calculated.
          -measurements
              The one-based indices of the measurements in the telemetry group that
              are shown in the comparison graph. Concatenate multiple values with
              commas, like "1,2". The default value is to show all measurements.
          -probeid
              The internal ID of the probe that should be exported. Run "jpexport
              -listProbes" to list all available built-in probes and for an
              explanation of custom probe names.
          -telemetrygroup
              Sets the one-based index of the telemetry group that should be
              exported. This refers to the the entries that you see in the drop-down
              list above the probe telemetry view. The default value is "1".

| Examples of using the comparison executable are:
      jpcompare test1.jps,test2.jps,test3.jps TelemetryHeap heap.html

      jpcompare test1.jps,test2.jps -sortbytime Objects -objects=recorded -aggregation=package objects.html

      jpcompare -listfile=snapshots.txt -ignoreerrors=true -outputdir=/tmp/export
                Objects objects.csv
                AllocationTree -class=java.lang.String allocations.xml