Revision 4149811a
Added by Andreas Kohlbecker over 8 years ago
src/main/java/org/cybertaxonomy/utis/utils/Profiler.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package org.cybertaxonomy.utis.utils; |
11 | 11 |
|
12 |
import java.io.IOException; |
|
13 | 12 |
import java.io.PrintStream; |
14 | 13 |
|
15 |
import com.yourkit.api.Controller; |
|
16 |
|
|
17 | 14 |
/** |
18 | 15 |
* @author a.kohlbecker |
19 | 16 |
* @date Oct 22, 2015 |
... | ... | |
21 | 18 |
*/ |
22 | 19 |
public class Profiler { |
23 | 20 |
|
24 |
private Controller yourkit; |
|
21 |
// private Controller yourkit;
|
|
25 | 22 |
private boolean yjp = false; |
26 | 23 |
private boolean cpu = false; |
27 | 24 |
private long start; |
... | ... | |
37 | 34 |
if(yjp) { |
38 | 35 |
// https://www.yourkit.com/docs/java/api/com/yourkit/api/Controller.html |
39 | 36 |
try { |
40 |
p.yourkit = new Controller(); |
|
41 |
p.yourkit.enableStackTelemetry(); |
|
42 |
p.yourkit.startCPUTracing(null); |
|
37 |
// p.yourkit = new Controller();
|
|
38 |
// p.yourkit.enableStackTelemetry();
|
|
39 |
// p.yourkit.startCPUTracing(null);
|
|
43 | 40 |
} catch (Exception e) { |
44 | 41 |
e.printStackTrace(); |
45 | 42 |
} |
... | ... | |
58 | 55 |
err.append(time.toString()).append(" ms\n"); |
59 | 56 |
if(yjp) { |
60 | 57 |
if(cpu) { |
61 |
yourkit.stopCPUProfiling(); |
|
62 |
String fileLocation = yourkit.captureSnapshot(com.yourkit.api.Controller.SNAPSHOT_WITHOUT_HEAP); |
|
63 |
err.append("Snapshot stored at: ").append(fileLocation).append("\n"); |
|
58 |
// yourkit.stopCPUProfiling();
|
|
59 |
// String fileLocation = yourkit.captureSnapshot(com.yourkit.api.Controller.SNAPSHOT_WITHOUT_HEAP);
|
|
60 |
// err.append("Snapshot stored at: ").append(fileLocation).append("\n");
|
|
64 | 61 |
} |
65 | 62 |
} |
66 |
} catch (IOException e) { |
|
67 |
e.printStackTrace(); |
|
63 |
// } catch (IOException e) {
|
|
64 |
// e.printStackTrace();
|
|
68 | 65 |
} catch (Exception e) { |
69 | 66 |
e.printStackTrace(); |
70 | 67 |
} |
Also available in: Unified diff
commenting out yourkit profiler reladed lines to avoid compilation problems