github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/server/stats.go (about)

     1  package server
     2  
     3  import "github.com/twmb/murmur3"
     4  
     5  const seed = 6231912
     6  
     7  type hashString string
     8  
     9  func (hs hashString) Sum64() uint64 {
    10  	return murmur3.SeedSum64(seed, []byte(hs))
    11  }
    12  
    13  func (ctrl *Controller) StatsInc(name string) {
    14  	ctrl.statsMutex.Lock()
    15  	defer ctrl.statsMutex.Unlock()
    16  
    17  	ctrl.stats[name]++
    18  }
    19  
    20  func (ctrl *Controller) Stats() map[string]int {
    21  	return ctrl.stats
    22  }
    23  
    24  func (ctrl *Controller) AppsCount() int {
    25  	return int(ctrl.appStats.Count())
    26  }