stats.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package runtime
  2. import "time"
  3. type Stat struct {
  4. // Timestamp is the time that the statistics where collected
  5. Timestamp time.Time
  6. Cpu Cpu `json:"cpu"`
  7. Memory Memory `json:"memory"`
  8. Pids Pids `json:"pids"`
  9. Blkio Blkio `json:"blkio"`
  10. Hugetlb map[string]Hugetlb `json:"hugetlb"`
  11. }
  12. type Hugetlb struct {
  13. Usage uint64 `json:"usage,omitempty"`
  14. Max uint64 `json:"max,omitempty"`
  15. Failcnt uint64 `json:"failcnt"`
  16. }
  17. type BlkioEntry struct {
  18. Major uint64 `json:"major,omitempty"`
  19. Minor uint64 `json:"minor,omitempty"`
  20. Op string `json:"op,omitempty"`
  21. Value uint64 `json:"value,omitempty"`
  22. }
  23. type Blkio struct {
  24. IoServiceBytesRecursive []BlkioEntry `json:"ioServiceBytesRecursive,omitempty"`
  25. IoServicedRecursive []BlkioEntry `json:"ioServicedRecursive,omitempty"`
  26. IoQueuedRecursive []BlkioEntry `json:"ioQueueRecursive,omitempty"`
  27. IoServiceTimeRecursive []BlkioEntry `json:"ioServiceTimeRecursive,omitempty"`
  28. IoWaitTimeRecursive []BlkioEntry `json:"ioWaitTimeRecursive,omitempty"`
  29. IoMergedRecursive []BlkioEntry `json:"ioMergedRecursive,omitempty"`
  30. IoTimeRecursive []BlkioEntry `json:"ioTimeRecursive,omitempty"`
  31. SectorsRecursive []BlkioEntry `json:"sectorsRecursive,omitempty"`
  32. }
  33. type Pids struct {
  34. Current uint64 `json:"current,omitempty"`
  35. Limit uint64 `json:"limit,omitempty"`
  36. }
  37. type Throttling struct {
  38. Periods uint64 `json:"periods,omitempty"`
  39. ThrottledPeriods uint64 `json:"throttledPeriods,omitempty"`
  40. ThrottledTime uint64 `json:"throttledTime,omitempty"`
  41. }
  42. type CpuUsage struct {
  43. // Units: nanoseconds.
  44. Total uint64 `json:"total,omitempty"`
  45. Percpu []uint64 `json:"percpu,omitempty"`
  46. Kernel uint64 `json:"kernel"`
  47. User uint64 `json:"user"`
  48. }
  49. type Cpu struct {
  50. Usage CpuUsage `json:"usage,omitempty"`
  51. Throttling Throttling `json:"throttling,omitempty"`
  52. }
  53. type MemoryEntry struct {
  54. Limit uint64 `json:"limit"`
  55. Usage uint64 `json:"usage,omitempty"`
  56. Max uint64 `json:"max,omitempty"`
  57. Failcnt uint64 `json:"failcnt"`
  58. }
  59. type Memory struct {
  60. Cache uint64 `json:"cache,omitempty"`
  61. Usage MemoryEntry `json:"usage,omitempty"`
  62. Swap MemoryEntry `json:"swap,omitempty"`
  63. Kernel MemoryEntry `json:"kernel,omitempty"`
  64. KernelTCP MemoryEntry `json:"kernelTCP,omitempty"`
  65. Raw map[string]uint64 `json:"raw,omitempty"`
  66. }