コード例 #1
0
ファイル: responder.go プロジェクト: iwada/cgrates
func (rs *Responder) Status(arg string, reply *map[string]interface{}) (err error) {
	memstats := new(runtime.MemStats)
	runtime.ReadMemStats(memstats)
	response := make(map[string]interface{})
	response[utils.InstanceID] = config.CgrConfig().InstanceID
	if rs.Bal != nil {
		response["Raters"] = rs.Bal.GetClientAddresses()
	}
	response["memstat"] = utils.SizeFmt(float64(memstats.HeapAlloc), "")
	response["footprint"] = utils.SizeFmt(float64(memstats.Sys), "")
	*reply = response
	return
}
コード例 #2
0
ファイル: responder.go プロジェクト: eloycoto/cgrates
func (rs *Responder) Status(arg string, reply *map[string]interface{}) (err error) {
	if arg != "" { // Introduce  delay in answer, used in some automated tests
		if delay, err := utils.ParseDurationWithSecs(arg); err == nil {
			time.Sleep(delay)
		}
	}
	memstats := new(runtime.MemStats)
	runtime.ReadMemStats(memstats)
	response := make(map[string]interface{})
	response[utils.InstanceID] = config.CgrConfig().InstanceID
	if rs.Bal != nil {
		response["Raters"] = rs.Bal.GetClientAddresses()
	}
	response["memstat"] = utils.SizeFmt(float64(memstats.HeapAlloc), "")
	response["footprint"] = utils.SizeFmt(float64(memstats.Sys), "")
	*reply = response
	return
}