public static void main(String[] args) { new LookAtMe((System.currentTimeMillis() % 3000) + 100).start(); new LookAtMe((System.currentTimeMillis() % 3000) + 300).start(); new LookAtMe((System.currentTimeMillis() % 3000) + 500).start(); new LookAtMe((System.currentTimeMillis() % 3000) + 700).start(); new LookAtMe((System.currentTimeMillis() % 3000) + 900).start(); } }
다음 화면과 같이 컴파일한다.
Remote site 에 TPTP 4.4.1 설치하고 실행하기
Eclipse 내에서 실행되는 Application 을 profiling 하기 위해서는 Integrated Agent Controller 를 쓰면 되기 때문에 Eclipse 외에 별도의 설치가 필요없다.
하지만, Remote site 에서 실행되는 Application 을 Profiling 하기 위해서는 Remote site 에 별도의 TPTP Agent Controller 를 설치해줘야 한다. (이 문서에서는 하나의 컴퓨터에서 모두 설정하지만, Eclipse 가 실행되는 환경과 Remote site 는 별개의 컴퓨터라고 샘각해야 한다.)
Remote site 에 TPTP Agent Controller 를 설치하려면, 다음 URL 에서 Remote site 의 환경에 맞는 TPTP 를 설치한다.
@(#)JVMTI Agent version 1.0.0.1 Usage: -agentlib:JPIBootLoader=JPIAgent[:[help]|[<option>=<value>, ...]];<profiler>
Where: help Displays this message <option>=<value> Command line options (see below) <profiler> The profiler to launch: CGProf Execution time analysis HeapProf Memory analysis ThreadProf Thread analysis
Supported option names and values: server=standalone|enabled|controlled file=<file> Output file (default is trace.trcxml) Only applicable when server=standalone filters=<file> Filter definition file (default is filters.txt) Only applicable when server=standalone profiler=<file> Profiling options file (default is jvmti.pro) Only applicable when server=standalone
Examples
Execution time analysis in standalone mode: java -agentlib:JPIBootLoader=JPIAgent:server=standalone,file=log.trcxml;CGProf < Java class file>
Memory analysis in controlled mode: java -agentlib:JPIBootLoader=JPIAgent:server=controlled;HeapProf <Java class fil e>
Error occurred during initialization of VM agent library failed to init: JPIBootLoader
이렇게 안내문이 출력되면 설정은 잘 된것이다.
추가로, 다음과 같이 Eclipse 없이 독자적으로 Profiling 을 하는 Standalong 모드로 실행해서 Profiling 이 잘 되는지를 확인해본다.