示例#1
0
文件: status.go 项目: hanwen/termite
func (w *Worker) Status(req *WorkerStatusRequest, rep *WorkerStatusResponse) error {
	w.mirrors.Status(req, rep)

	// TODO - pass WorkerOptions out.
	rep.MaxJobCount = w.options.Jobs
	rep.Version = Version()
	rep.Accepting = w.accepting
	rep.CpuStats = w.stats.CpuStats()
	rep.DiskStats = w.stats.DiskStats()
	rep.PhaseCounts = w.stats.PhaseCounts()
	rep.PhaseNames = w.stats.PhaseOrder
	rep.TotalCpu = *stats.TotalCpuStat()
	rep.MemStat = *stats.GetMemStat()
	return nil
}
示例#2
0
文件: worker.go 项目: janneke/termite
func (me *Worker) PeriodicHouseholding() {
	for me.accepting {
		me.Report()
		if me.options.HeapLimit > 0 {
			heap := stats.GetMemStat().Total()
			if heap > me.options.HeapLimit {
				log.Println("Exceeded heap limit. Restarting...")
				me.shutdown(true, false)
			}
		}

		c := time.After(me.options.ReportInterval)
		<-c
	}
}
示例#3
0
文件: status.go 项目: janneke/termite
func (me *Worker) Status(req *WorkerStatusRequest, rep *WorkerStatusResponse) error {
	me.mirrors.Status(req, rep)

	// TODO - pass WorkerOptions out.
	rep.MaxJobCount = me.options.Jobs
	rep.Version = Version()
	rep.Accepting = me.accepting
	rep.CpuStats = me.stats.CpuStats()
	rep.DiskStats = me.stats.DiskStats()
	rep.PhaseCounts = me.stats.PhaseCounts()
	rep.PhaseNames = me.stats.PhaseOrder
	rep.TotalCpu = *stats.TotalCpuStat()
	rep.ContentCacheHitRate = me.content.MemoryHitRate()
	rep.ContentCacheHitAge = me.content.MemoryHitAge()
	rep.MemStat = *stats.GetMemStat()
	return nil
}