Skip to content

Commit af09b45

Browse files
committed
metric.go: add structures about runtime metrics from runtime method.
1 parent 29289d9 commit af09b45

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

metric/metric.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package metric
2+
3+
// Metrics contains status about runtime submodules.
4+
type Metrics struct {
5+
Library LTStatus `toml:"library" json:"library"`
6+
Memory MTStatus `toml:"memory" json:"memory"`
7+
Thread TTStatus `toml:"thread" json:"thread"`
8+
Resource RTStatus `toml:"resource" json:"resource"`
9+
Sysmon SMStatus `toml:"sysmon" json:"sysmon"`
10+
Watchdog WDStatus `toml:"watchdog" json:"watchdog"`
11+
}
12+
13+
// LTStatus contains status about library tracker.
14+
type LTStatus struct {
15+
NumModules int64 `toml:"num_modules" json:"num_modules"`
16+
}
17+
18+
// MTStatus contains status about memory tracker.
19+
type MTStatus struct {
20+
NumGlobals int64 `toml:"num_globals" json:"num_globals"`
21+
NumLocals int64 `toml:"num_locals" json:"num_locals"`
22+
NumBlocks int64 `toml:"num_blocks" json:"num_blocks"`
23+
NumRegions int64 `toml:"num_regions" json:"num_regions"`
24+
NumPages int64 `toml:"num_pages" json:"num_pages"`
25+
NumHeaps int64 `toml:"num_heaps" json:"num_heaps"`
26+
}
27+
28+
// TTStatus contains status about thread tracker.
29+
type TTStatus struct {
30+
NumThreads int64 `toml:"num_threads" json:"num_threads"`
31+
NumTLSIndex int64 `toml:"num_tls_index" json:"num_tls_index"`
32+
NumSuspend int64 `toml:"num_suspend" json:"num_suspend"`
33+
}
34+
35+
// RTStatus contains status about resource tracker.
36+
type RTStatus struct {
37+
NumMutexs int64 `toml:"num_mutexs" json:"num_mutexs"`
38+
NumEvents int64 `toml:"num_events" json:"num_events"`
39+
NumSemaphores int64 `toml:"num_semaphores" json:"num_semaphores"`
40+
NumWaitableTimers int64 `toml:"num_waitable_timers" json:"num_waitable_timers"`
41+
NumFiles int64 `toml:"num_files" json:"num_files"`
42+
NumDirectories int64 `toml:"num_directories" json:"num_directories"`
43+
NumIOCPs int64 `toml:"num_iocps" json:"num_iocps"`
44+
NumKeys int64 `toml:"num_keys" json:"num_keys"`
45+
NumSockets int64 `toml:"num_sockets" json:"num_sockets"`
46+
}
47+
48+
// SMStatus contains status about sysmon.
49+
type SMStatus struct {
50+
NumNormal int64 `toml:"num_normal" json:"num_normal"`
51+
NumRecover int64 `toml:"num_recover" json:"num_recover"`
52+
NumPanic int64 `toml:"num_panic" json:"num_panic"`
53+
}
54+
55+
// WDStatus contains status about watchdog.
56+
type WDStatus struct {
57+
NumKick int64 `toml:"num_kick" json:"num_kick"`
58+
NumNormal int64 `toml:"num_normal" json:"num_normal"`
59+
NumReset int64 `toml:"num_reset" json:"num_reset"`
60+
}

0 commit comments

Comments
 (0)