eth/downloader: fix string formatting per review requests

This commit is contained in:
Péter Szilágyi 2016-06-03 11:05:25 +03:00
parent c02170de4e
commit 2925dc3f07
2 changed files with 11 additions and 10 deletions

View file

@ -1903,7 +1903,7 @@ func (d *Downloader) qosTuner() {
atomic.StoreUint64(&d.rttConfidence, conf)
// Log the new QoS values and sleep until the next RTT
glog.V(logger.Debug).Infof("quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL())
glog.V(logger.Debug).Infof("Quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL())
time.Sleep(rtt)
}
}
@ -1929,7 +1929,7 @@ func (d *Downloader) qosReduceConfidence() {
atomic.StoreUint64(&d.rttConfidence, conf)
rtt := time.Duration(atomic.LoadUint64(&d.rttEstimate))
glog.V(logger.Debug).Infof("quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL())
glog.V(logger.Debug).Infof("Quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL())
}
// requestRTT returns the current target round trip time for a download request

View file

@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"math"
"strings"
"sync"
"sync/atomic"
"time"
@ -366,14 +367,14 @@ func (p *peer) String() string {
p.lock.RLock()
defer p.lock.RUnlock()
return fmt.Sprintf("Peer %s [%s]", p.id,
fmt.Sprintf("hs %3.2f/s, ", p.headerThroughput)+
fmt.Sprintf("bs %3.2f/s, ", p.blockThroughput)+
fmt.Sprintf("rs %3.2f/s, ", p.receiptThroughput)+
fmt.Sprintf("ss %3.2f/s, ", p.stateThroughput)+
fmt.Sprintf("miss %4d, ", len(p.lacking))+
fmt.Sprintf("rtt %v", p.rtt),
)
return fmt.Sprintf("Peer %s [%s]", p.id, strings.Join([]string{
fmt.Sprintf("hs %3.2f/s", p.headerThroughput),
fmt.Sprintf("bs %3.2f/s", p.blockThroughput),
fmt.Sprintf("rs %3.2f/s", p.receiptThroughput),
fmt.Sprintf("ss %3.2f/s", p.stateThroughput),
fmt.Sprintf("miss %4d", len(p.lacking)),
fmt.Sprintf("rtt %v", p.rtt),
}, ", "))
}
// peerSet represents the collection of active peer participating in the chain