java - hibernate generate_statistics 将纳秒更改为秒

标签 java hibernate

我使用 hibernate StatisticalLoggingSessionEventListener 来显示查询响应时间

这是日志

2016-01-20 11:10:48.841  INFO 12769 --- [http-nio-8081-exec-1] i.StatisticalLoggingSessionEventListener : Session Metrics {
  66145 nanoseconds spent acquiring 1 JDBC connections;
  0 nanoseconds spent releasing 0 JDBC connections;
  6081355 nanoseconds spent preparing 212 JDBC statements;
  14977371 nanoseconds spent executing 212 JDBC statements;
  0 nanoseconds spent executing 0 JDBC batches;
  0 nanoseconds spent performing 0 L2C puts;
  0 nanoseconds spent performing 0 L2C hits;
  0 nanoseconds spent performing 0 L2C misses;
  0 nanoseconds spent executing 0 flushes (flushing a total of 0 entities and 0 collections);
  0 nanoseconds spent executing 0 partial-flushes (flushing a total of 0 entities and 0 collections)
}

我们可以将纳秒值转换为秒吗?

最佳答案

不,它不能改变 这是类文件 https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/engine/internal/StatisticalLoggingSessionEventListener.java

他们使用 System.nanoTime() 来获取值并且没有额外的配置。

关于java - hibernate generate_statistics 将纳秒更改为秒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34907024/

相关文章:

java - Android 上的 .connect() 程序崩溃,未连接

Java 8 : modify specific element in the stream by using lambda expressions

java - 仅用于审计目的的 ER 建模字符串对象列表

java - 如何使用免费工具查找类加载器泄漏?

java - 基本的 Hibernate 缓存问题

hibernate - 从 ehcache 加载 hibernate 对象时出现延迟初始化异常

java - 奇怪的错误 : Beans not created, "Can not configure endpoints"

java - 测试 BigDecimal 是否可以更改其他 BigDecimal 的整数部分

java - Java中的同步函数

java - 我是否在组合键中正确定义了多对一?