HHH-9344 Convert QueryLoader to use nanoTime instead of currentTimeMillis
This commit is contained in:
parent
16b067cd7d
commit
193c8cef20
|
@ -32,6 +32,7 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
|
@ -509,7 +510,7 @@ public class QueryLoader extends BasicLoader {
|
||||||
final boolean stats = session.getFactory().getStatistics().isStatisticsEnabled();
|
final boolean stats = session.getFactory().getStatistics().isStatisticsEnabled();
|
||||||
long startTime = 0;
|
long startTime = 0;
|
||||||
if ( stats ) {
|
if ( stats ) {
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -530,11 +531,13 @@ public class QueryLoader extends BasicLoader {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( stats ) {
|
if ( stats ) {
|
||||||
|
final long endTime = System.nanoTime();
|
||||||
|
final long milliseconds = TimeUnit.MILLISECONDS.convert( endTime - startTime, TimeUnit.NANOSECONDS );
|
||||||
session.getFactory().getStatisticsImplementor().queryExecuted(
|
session.getFactory().getStatisticsImplementor().queryExecuted(
|
||||||
// "HQL: " + queryTranslator.getQueryString(),
|
// "HQL: " + queryTranslator.getQueryString(),
|
||||||
getQueryIdentifier(),
|
getQueryIdentifier(),
|
||||||
0,
|
0,
|
||||||
System.currentTimeMillis() - startTime
|
milliseconds
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue