代码拉取完成,页面将自动刷新
同步操作将从 menuiis/gkit 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package watching
import (
"os"
"time"
)
const (
defaultThreadTriggerMin = 10 // 10 threads
defaultThreadTriggerAbs = 70 // 70 threads
defaultThreadTriggerDiff = 25 // 25%
defaultCPUTriggerMin = 10 // 10%
defaultCPUTriggerAbs = 70 // 70%
defaultCPUTriggerDiff = 25 // 25%
defaultCPUSamplingTime = 5 * time.Second // collect 5s cpu profile
defaultGoroutineTriggerMin = 3000 // 3000 goroutines
defaultGoroutineTriggerAbs = 200000 // 200k goroutines
defaultGoroutineTriggerDiff = 20 // 20% diff
defaultMemTriggerMin = 10 // 10%
defaultMemTriggerAbs = 80 // 80%
defaultMemTriggerDiff = 25 // 25%
defaultGCHeapTriggerMin = 10 // 10%
defaultGCHeapTriggerAbs = 40 // 40%
defaultGCHeapTriggerDiff = 20 // 20%
defaultInterval = 5 * time.Second
defaultCooldown = time.Minute
defaultDumpProfileType = binaryDump
defaultDumpPath = "./tmp"
defaultLoggerName = "watching.log"
defaultLoggerFlags = os.O_RDWR | os.O_CREATE | os.O_APPEND
defaultLoggerPerm = 0o644
defaultShardLoggerSize = 52428800 // 50m
)
type dumpProfileType int
const (
binaryDump dumpProfileType = 0
textDump dumpProfileType = 1
)
type configureType int
const (
mem configureType = iota
cpu
thread
goroutine
gcHeap
)
var type2name = map[configureType]string{
mem: "mem",
cpu: "cpu",
thread: "thread",
goroutine: "goroutine",
gcHeap: "gcHeap",
}
const (
cgroupMemLimitPath = "/sys/fs/cgroup/memory/memory.limit_in_bytes"
cgroupCpuQuotaPath = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
cgroupCpuPeriodPath = "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
)
const minCollectCyclesBeforeDumpStart = 10
const (
LogLevelInfo = iota
LogLevelDebug
)
const (
// TrimResultTopN trimResult return only reserve the top n.
TrimResultTopN = 10
// NotSupportTypeMaxConfig means this profile type is
// not support control dump profile by max parameter.
NotSupportTypeMaxConfig = 0
// UniformLogFormat is the format of uniform logging.
UniformLogFormat = "[Watching] %v %v, config_min : %v, config_diff : %v, config_abs : %v, config_max : %v, previous : %v, current: %v"
)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。