1 Star 0 Fork 3

Fengzhi/gkit

forked from menuiis/gkit 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
consts.go 2.13 KB
一键复制 编辑 原始数据 按行查看 历史
SongZhibin97 提交于 2022-02-17 13:43 +08:00 . fix:config assert err
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"
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fengzhi_1/gkit.git
git@gitee.com:fengzhi_1/gkit.git
fengzhi_1
gkit
gkit
b6285053065d

搜索帮助