public JVMMetricsListDataVO getJVMMemoryMaxSize()

in backend/src/main/java/org/apache/iotdb/admin/service/impl/MetricsServiceImpl.java [786:839]


  public JVMMetricsListDataVO getJVMMemoryMaxSize(Connection connection) throws BaseException {
    String name = "JVM最大内存";
    String metricType = "内存";
    String pattern = "yyyy-MM-dd' 'HH:mm:ss.SSS";
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
    Integer detailAvailable = 0;
    int port = connection.getPort();
    // TODO bug 修复后删除
    if (port == 6668) {
      port = 8086;
    }
    String sql =
        "select * from "
            + "root._metric.\"127.0.0.1:"
            + port
            + "\".\"jvm.memory.max\".\"area=nonheap\".\"id=Compressed Class Space\", "
            + "root._metric.\"127.0.0.1:"
            + port
            + "\".\"jvm.memory.max\".\"area=nonheap\".\"id=Code Cache\", "
            + "root._metric.\"127.0.0.1:"
            + port
            + "\".\"jvm.memory.max\".\"area=nonheap\".\"id=Metaspace\", "
            + "root._metric.\"127.0.0.1:"
            + port
            + "\".\"jvm.memory.max\".\"area=heap\".\"id=PS Old Gen\", "
            + "root._metric.\"127.0.0.1:"
            + port
            + "\".\"jvm.memory.max\".\"area=heap\".\"id=PS Eden Space\", "
            + "root._metric.\"127.0.0.1:"
            + port
            + "\".\"jvm.memory.max\".\"area=heap\".\"id=PS Survivor Space\" "
            + "order by time desc limit 1";
    SessionPool sessionPool = getSessionPool(connection);
    List<String> values = executeQueryOneLine(sessionPool, sql);
    long lastestTimeStamp = Long.parseLong(values.get(0));
    String count =
        getNetFileSizeDescription(
            (long)
                (Double.parseDouble(values.get(1))
                    + Double.parseDouble(values.get(2))
                    + Double.parseDouble(values.get(3))
                    + Double.parseDouble(values.get(4))
                    + Double.parseDouble(values.get(5))
                    + Double.parseDouble(values.get(6))));
    String latestScratchTime = simpleDateFormat.format(lastestTimeStamp);
    String latestResult = count;
    JVMMetricsListDataVO jvmMetricsListDataVO = new JVMMetricsListDataVO();
    jvmMetricsListDataVO.setMetricType(metricType);
    jvmMetricsListDataVO.setDetailAvailable(detailAvailable);
    jvmMetricsListDataVO.setLatestResult(latestResult);
    jvmMetricsListDataVO.setLatestScratchTime(latestScratchTime);
    jvmMetricsListDataVO.setName(name);
    return jvmMetricsListDataVO;
  }