ProfilerUtil.java
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.cq.dam.s7imaging.impl;
public class ProfilerUtil {
private long processStart = 0;
private long methodStart = 0;
private StringBuilder logBuffer = new StringBuilder();
private void startTotalProcess() {
if (this.processStart == 0) {
this.processStart = System.currentTimeMillis();
}
}
public void start(String method) {
this.startTotalProcess();
boolean result = this.closeMethod();
if (result) {
this.logBuffer.append(",");
}
this.logBuffer.append(" ").append(method).append(":");
this.methodStart = System.currentTimeMillis();
}
private boolean closeMethod() {
if (this.methodStart > 0) {
this.logBuffer.append(System.currentTimeMillis() - this.methodStart).append(" ms");
return true;
}
return false;
}
private void closeProcess() {
if (this.processStart > 0) {
this.logBuffer.append(" Total:").append(System.currentTimeMillis() - this.processStart).append(" ms");
}
}
public String print() {
boolean result = this.closeMethod();
if (result) {
this.logBuffer.append(",");
}
this.closeProcess();
return this.logBuffer.toString();
}
}