@@ -12,7 +12,7 @@ type BaseStatNode struct {
1212 sampleCount uint32
1313 intervalMs uint32
1414
15- goroutineNum int32
15+ concurrency int32
1616
1717 arr * sbase.BucketLeapArray
1818 metric * sbase.SlidingWindowMetric
@@ -22,11 +22,11 @@ func NewBaseStatNode(sampleCount uint32, intervalInMs uint32) *BaseStatNode {
2222 la := sbase .NewBucketLeapArray (config .GlobalStatisticSampleCountTotal (), config .GlobalStatisticIntervalMsTotal ())
2323 metric , _ := sbase .NewSlidingWindowMetric (sampleCount , intervalInMs , la )
2424 return & BaseStatNode {
25- goroutineNum : 0 ,
26- sampleCount : sampleCount ,
27- intervalMs : intervalInMs ,
28- arr : la ,
29- metric : metric ,
25+ concurrency : 0 ,
26+ sampleCount : sampleCount ,
27+ intervalMs : intervalInMs ,
28+ arr : la ,
29+ metric : metric ,
3030 }
3131}
3232
@@ -66,21 +66,16 @@ func (n *BaseStatNode) MinRT() float64 {
6666 return float64 (n .metric .MinRT ())
6767}
6868
69- func (n * BaseStatNode ) CurrentGoroutineNum () int32 {
70- return atomic .LoadInt32 (& (n .goroutineNum ))
69+ func (n * BaseStatNode ) CurrentConcurrency () int32 {
70+ return atomic .LoadInt32 (& (n .concurrency ))
7171}
7272
73- func (n * BaseStatNode ) IncreaseGoroutineNum () {
74- atomic .AddInt32 (& (n .goroutineNum ), 1 )
73+ func (n * BaseStatNode ) IncreaseConcurrency () {
74+ atomic .AddInt32 (& (n .concurrency ), 1 )
7575}
7676
77- func (n * BaseStatNode ) DecreaseGoroutineNum () {
78- atomic .AddInt32 (& (n .goroutineNum ), - 1 )
79- }
80-
81- func (n * BaseStatNode ) Reset () {
82- // TODO: this should be thread-safe, or error may occur
83- panic ("to be implemented" )
77+ func (n * BaseStatNode ) DecreaseConcurrency () {
78+ atomic .AddInt32 (& (n .concurrency ), - 1 )
8479}
8580
8681func (n * BaseStatNode ) GenerateReadStat (sampleCount uint32 , intervalInMs uint32 ) (base.ReadStat , error ) {
0 commit comments