pimprof.sh script

Use the pimprof.sh script to start, and stop services, and to capture memory snapshots in the IBM® Product Master environment.

Syntax

pimprof.sh –-cmd=command 
--mode=cpu|obj 
--svc_name=unique_Service_Name 
--file=filename 
--opts=” “ 

Parameters

–-cmd=command
Specify the action to be performed on the service. The allowed actions are start and stop for a service, and capture_mem for capturing a memory snapshot.
--mode=cpu|obj
Specify the full RMI name of the service.
cpu
The CPU profiling mode.
obj
The object allocation tracing mode.
--svc_name=unique_Service_Name
Specify the unique service name of the service that you specified for the --serviceType parameter. If the unique_Service_Name is not specified, the service that is specified as default is enabled for profiling.
serviceName
The unique service name of the service.
--file=filename
Specify the name of the file with the full path to save the memory snapshot. If the file name and directory are not specified, the default $TOP/profiler/snapshots directory is where the memory snapshot exists. If the file name and directory are not specified, the default $TOP/tmp directory is where the memory snapshot is saved. fileName is the fully qualified directory and file name of the memory snapshot that is saved when either the profiling completes or you issue the --stop command. If you do not specify the --file parameter, the file name defaults are:
  • For YourKit: prof_type_serviceType_serviceName_timeStamp.snapshot
  • For JProfiler: prof_type_serviceType_serviceName_timeStamp.jps
where:
prof_type
The profiling mode, either cpu or obj.
serviceType
One of six services.
timeStamp
The date and time that the file is created.
--opts=” “
Specify this option to request help information.

pimprof.sh enable profiling

Run the following command to enable profiling:
pimprof.sh --enable 
--profilerName=yourkit|jprofiler 
--serviceType=admin|appsvr|event|queuemgr|scheduler|workflow 
--serviceName=unique_Service_Name 
--port=port_#
--enable
Enables profiling.
--profilerName=yourkit|jprofiler
yourkit
The YourKit profiling agent.
jprofiler
The JProfiler profiling agent.
--serviceType=admin|appsvr|event|queuemgr|scheduler|workflow
admin
The admin service.
appsvr
The application server service.
event
The event processor service.
queuemgr
The queue manager service.
scheduler
The scheduler service.
workflow
The workflow engine service.
--serviceName=unique_Service_Name
The unique service name of the service you specified for the --serviceType parameter. If the unique_Service_Name is not specified, the service that is specified as default is enabled for profiling.
--port=port_#
The unique port number of the service you specified for the --serviceName parameter If you do not specify the port_#, the port numbers specified in the common.properties file for the following parameters are used:
  • profiler_port_admin
  • profiler_port_appsvr
  • profiler_port_event
  • profiler_port_queuemgr
  • profiler_port_scheduler
  • profiler_port_workflow

YourKit parameters for starting profiling

You can run these additional parameters for YourKit:
--cpuCapture=sampling|tracing|j2ee --allocMode=adaptive|all
The following parameters are defined:
sampling
Records CPU times with adequate profiling detail and a low performance overhead impact. This is a default parameter.
tracing
Records CPU times as well as method invocation counts. This is a default parameter. This parameter decreases performance, therefore, it should be used only when necessary.
j2ee
Offers high-level profiling of JDBC, JSP or Servlets, and JNDI calls. This parameter increases performance, therefore, it should be used only when necessary.
adaptive
Adaptively skips some object allocation tracing while keeping CPU processing overhead at a moderate level. This is a default parameter.
all
Traces each object allocation.

JProfiler parameters for starting profiling

You can run these additional parameters for JProfiler:
--reset=true|false --saveOnExit=true|false
The following parameters are defined:
--reset=true|false
Discards all past CPU profiling data.
--saveOnExit=true|false
Saves a snapshot of all of your profiling data when profiling ends. This is a default parameter.

Capture memory snapshot parameters

You can run this script to capture the memory snapshot file:
pimprof.sh –cmd=capture_mem 
–—svc_name=unique_Service_Name 
--file=fileName
The following parameters are defined:
–cmd=capture_mem
Captures the memory snapshot.
–—svc_name=unique_Service_Name
The unique service name of the service you specified for the --serviceType parameter If the unique_Service_Name is not specified, the service that is specified as default is enabled for profiling.
--file=fileName
If the file name and directory are not specified, the default $TOP/profiler/snapshots directory is where the memory snapshot is saved. fileName is the fully qualified directory and file name of the memory snapshot that is saved when either the profiling completes or you issue the --stop command If you do not specify the --file parameter, the file name defaults are:
  • For YourKit: MEM_serviceType_serviceName_timeStamp.snapshot
  • For JProfiler: MEM_serviceType_serviceName_timeStamp.jps
where:
serviceType
One of six services.
serviceName
The unique service name of the service.
timeStamp
The date and time that the file is created.

Save memory snapshot parameters

You can run this script to save the memory snapshot:
pimprof.sh –cmd=save 
–—svc_name=unique_Service_Name 
--file=fileName
 --snapshot_mode=without_heap|with_heap

The following parameters are defined:

–cmd=save
Saves intermediate profiling data.
–—svc_name=unique_Service_Name
The unique service name of the service you specified for the --serviceType parameter If the unique_Service_Name is not specified, the service that is specified as default is enabled for profiling.
--file=fileName
If the file name and directory are not specified, the default $TOP/profiler/snapshots directory is where the memory snapshot is saved. fileName is the fully qualified directory and file name of the memory snapshot that is saved when either the profiling completes or you issue the --stop command If you do not specify the --file parameter, the file name defaults are:
  • For YourKit: PROFILER_serviceType_serviceName_timeStamp.snapshot
  • For JProfiler: PROFILER_serviceType_serviceName_timeStamp.jps
where:
serviceType
One of six services.
serviceName
The unique service name of the service.
timeStamp
The date and time that the file is created.
--snapshot_mode=without_heap|with_heap
A memory snapshot includes all classes loaded by the JVM, the existing objects, and references between the objects.
without_heap
Captures the memory snapshot without the heap memory dump. This is a default parameter.
with_heap
Captures the memory snapshot with the heap memory dump

YourKit parameters for saving memory snapshot

You can run these additional parameters for YourKit:
--hprof=true|false

The following parameters are defined:

--hprof=true|false
A memory snapshot in a hprof format.
false
Captures the snapshot in the YourKit format. This is a default parameter.
true
Captures the snapshot in hprof format so that only heap dumps are created and no other YourKit profiling data is captured.

Example

In this example, the pimprof.sh script is run with the parameters cmd = capture_mem, mode = cpu, svc_name = admin and file = /store/pimprof_data:
$<install directory>/bin/pimprof.sh 
–-cmd=capture_mem 
--mode=cpu 
--svc_name=admin 
--file=/store/pimprof_data 
The pimprof.sh shell script should be run from within the same shell by using ″dot space″, see the following examples:
In this example, the YourKit profiling agent is enabled to profile the CPU for the admin service:
  • $TOP/bin/pimprof.sh --enable --serviceType=scheduler --profilerName=yourkit
  • $TOP/bin/pimprof.sh --start cpu --serviceType=admin
In this example, the scheduler service, which has the unique service name myscheduler, is stopped. The directory and file name where the profiling data is saved, is specified as /opt/snapshots/mysch.snapshot:
  • $TOP/bin/pimprof.sh --stop obj --serviceType=scheduler --serviceName=myscheduler --file=/opt/snapshots/mysch.snapshot
In this example, a memory snapshot is captured for the scheduler service and saved in the default directory with default file name:
  • $TOP/bin/pimprof.sh --capturemem --serviceType=scheduler
Profiling will remain enabled until you individually disable the feature for each service.