All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mrcd.mmat.monitor.MonitorManager.kt Maven / Gradle / Ivy

The newest version!
package com.mrcd.mmat.monitor

import com.mrcd.mmat.MMATConfig
import com.mrcd.mmat.monitor.model.SystemInfo

/**
 * 
Description: *
*
*
Author: chenlin *
Date: 2021/10/27 */ object MonitorManager { //监控模块容器 private val mTrackMonitors = mutableListOf(JavaHeapOOMMonitor(),FastBigJavaHeapOOMMonitor()) //检测原因 private val mTrackReasons = mutableListOf() /** * 启动监控模块 */ fun startTrackJavaHeap(mmatConfig : MMATConfig, pid : Long) : Boolean{ //获取最新的内存数据 SystemInfo.getNewestMemoryInfo(pid) mTrackReasons.clear() for (oomTracker in mTrackMonitors) { if (oomTracker.trackJavaHeap(mmatConfig)) { mTrackReasons.add(oomTracker.reason()) } } if (mTrackReasons.isNotEmpty()) { println("mTrackReasons:${mTrackReasons}") } return mTrackReasons.isNotEmpty() } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy