Go-based FM stereo transmitter with RDS, Windows-first and cross-platform
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

54 行
1.8KB

  1. package aoiprxkit
  2. import "sync/atomic"
  3. type Stats struct {
  4. PacketsReceived uint64 `json:"packetsReceived"`
  5. PacketsParsed uint64 `json:"packetsParsed"`
  6. PacketsDelivered uint64 `json:"packetsDelivered"`
  7. PacketsLateDrop uint64 `json:"packetsLateDrop"`
  8. PacketsGapLoss uint64 `json:"packetsGapLoss"`
  9. PacketsWrongPT uint64 `json:"packetsWrongPayloadType"`
  10. PacketsShort uint64 `json:"packetsTooShort"`
  11. JitterReorders uint64 `json:"jitterReorders"`
  12. DecodeErrors uint64 `json:"decodeErrors"`
  13. SamplesDelivered uint64 `json:"samplesDelivered"`
  14. FramesDelivered uint64 `json:"framesDelivered"`
  15. LastSequence uint32 `json:"lastSequence"`
  16. SequenceValid uint32 `json:"sequenceValid"`
  17. }
  18. type statsAtomic struct {
  19. packetsReceived atomic.Uint64
  20. packetsParsed atomic.Uint64
  21. packetsDelivered atomic.Uint64
  22. packetsLateDrop atomic.Uint64
  23. packetsGapLoss atomic.Uint64
  24. packetsWrongPT atomic.Uint64
  25. packetsShort atomic.Uint64
  26. jitterReorders atomic.Uint64
  27. decodeErrors atomic.Uint64
  28. samplesDelivered atomic.Uint64
  29. framesDelivered atomic.Uint64
  30. lastSequence atomic.Uint32
  31. sequenceValid atomic.Uint32
  32. }
  33. func (s *statsAtomic) snapshot() Stats {
  34. return Stats{
  35. PacketsReceived: s.packetsReceived.Load(),
  36. PacketsParsed: s.packetsParsed.Load(),
  37. PacketsDelivered: s.packetsDelivered.Load(),
  38. PacketsLateDrop: s.packetsLateDrop.Load(),
  39. PacketsGapLoss: s.packetsGapLoss.Load(),
  40. PacketsWrongPT: s.packetsWrongPT.Load(),
  41. PacketsShort: s.packetsShort.Load(),
  42. JitterReorders: s.jitterReorders.Load(),
  43. DecodeErrors: s.decodeErrors.Load(),
  44. SamplesDelivered: s.samplesDelivered.Load(),
  45. FramesDelivered: s.framesDelivered.Load(),
  46. LastSequence: s.lastSequence.Load(),
  47. SequenceValid: s.sequenceValid.Load(),
  48. }
  49. }