Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add disk stats to HTTP status; make things compile again.

  • Loading branch information...
commit 9752c979e07f56852f05da05867fb608bc4440ac 1 parent 338da66
@hanwen authored
View
2  cba/throughput.go
@@ -25,7 +25,7 @@ func (s *ThroughputSample) String() string {
return fmt.Sprintf("received %v, sent %v", s.received, s.served)
}
-func (s *ThroughputSample) SubSample(r stats.Sample) {
+func (s *ThroughputSample) SubtractSample(r stats.Sample) {
t := r.(*ThroughputSample)
s.served -= t.served
s.received -= t.received
View
2  stats/iostats.go
@@ -163,7 +163,7 @@ func (d *diskSample) TableRow() string {
return fmt.Sprintf("<tr><td>%d</td><td>%d</td></tr>", d.MergedReadsCompleted, d.WritesCompleted)
}
-func (s *DiskStatSampler) Stats() (out []DiskStat) {
+func (s *DiskStatSampler) DiskStats() (out []DiskStat) {
diffs := s.sampler.Diffs()
for _, d := range diffs {
samp := d.(*diskSample)
View
4 stats/serverstats.go
@@ -66,7 +66,7 @@ func CpuStatsWriteHttp(w http.ResponseWriter, stats []CpuStat, disk []DiskStat)
if printChild {
chHeader = "<th>child cpu (ms)</th><th>child sys (ms)</th>"
}
- fmt.Fprintf(w, "<p><table><tr><th>self cpu (ms)</th><th>self sys (ms)</th>%s<th>total</th><th>read ops</th><th>write ops</th></tr>",
+ fmt.Fprintf(w, "<p><table><tr><th>self cpu (ms)</th><th>self sys (ms)</th>%s<th>total (ms)</th><th>read ops</th><th>write ops</th></tr>",
chHeader)
for i, v := range stats {
if i < len(stats)-5 {
@@ -117,7 +117,7 @@ func CountStatsWriteHttp(w http.ResponseWriter, names []string, counts []int) {
func (me *ServerStats) WriteHttp(w http.ResponseWriter) {
cpu := me.CpuStats()
- disk := me.DiskStatSampler.Stats()
+ disk := me.DiskStats()
l := len(cpu)
if len(disk) < l {
View
2  termite/coordinator.go
@@ -393,7 +393,7 @@ func (me *Coordinator) workerHandler(w http.ResponseWriter, req *http.Request) {
if !status.Accepting {
fmt.Fprintf(w, "<b>shutting down</b>")
}
- stats.CpuStatsWriteHttp(w, status.CpuStats)
+ stats.CpuStatsWriteHttp(w, status.CpuStats, status.DiskStats)
fmt.Fprintf(w, "<p>Total CPU: %s", status.TotalCpu.Percent())
fmt.Fprintf(w, "<p>Content cache hit rate: %.0f %%, Age %d",
View
1  termite/rpc.go
@@ -57,6 +57,7 @@ type WorkerStatusResponse struct {
// In chronological order.
CpuStats []stats.CpuStat
TotalCpu stats.CpuStat
+ DiskStats []stats.DiskStat
ContentCacheHitRate float64
ContentCacheHitAge int
View
1  termite/status.go
@@ -28,6 +28,7 @@ func (me *Worker) Status(req *WorkerStatusRequest, rep *WorkerStatusResponse) er
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()
Please sign in to comment.
Something went wrong with that request. Please try again.