예제 #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
}