package io.ebeaninternal.server.transaction;
import io.ebean.ProfileLocation;
public class TransactionProfile {
private final ProfileLocation location;
private final String label;
private final long startTime;
private long totalMicros;
private String data;
private Summary summary;
public TransactionProfile(long startTime, ProfileLocation location) {
this.location = location;
this.label = location.label();
this.startTime = startTime;
this.summary = new Summary();
}
public String getLabel() {
return label;
}
public long getStartTime() {
return startTime;
}
public long getTotalMicros() {
return totalMicros;
}
public String getData() {
return data;
}
public void setTotalMicros(long totalMicros) {
this.totalMicros = totalMicros;
}
public void setData(String data) {
this.data = data;
}
public Summary getSummary() {
return summary;
}
public void setSummary(Summary summary) {
this.summary = summary;
}
public static class Summary {
public long queryMicros;
public long queryCount;
public long queryBeans;
public long queryMax;
public long persistMicros;
public long persistCount;
public long persistBeans;
public long persistOneCount;
public long commitMicros;
void addPersist(long micros, int beanCount) {
persistMicros += micros;
persistBeans += beanCount;
persistCount++;
if (beanCount == 1) {
persistOneCount++;
}
}
void addQuery(long micros, int beanCount) {
queryMax = Math.max(queryMax, micros);
queryMicros += micros;
queryBeans += beanCount;
queryCount++;
}
}
}