Disable debug time adjustment logging

When --debug is enabled, the following log messages are
printed every second filling up the log:

D0430 18:04:42.823775  129561 parameters.go:238] Clock(Monotonic): error: 46 ns, adjusted frequency from 3591713733 Hz to 3591714196 Hz
D0430 18:04:42.823870  129561 parameters.go:238] Clock(Realtime): error: 36 ns, adjusted frequency from 3591714003 Hz to 3591714169 Hz
D0430 18:04:42.823892  129561 timekeeper.go:209] Updating VDSO parameters: {monotonicReady:1 monotonicBaseCycles:15758797714254696 monotonicBaseRef:29000233837 monotonicFrequency:3591714196 realtimeReady:1 realtimeBaseCycles:15758797714610880 realtimeBaseRef:1588269882823867374 realtimeFrequency:3591714169}

Info and warning messages for larger changes are kept the same.

PiperOrigin-RevId: 321048523
This commit is contained in:
Fabricio Voznika
2020-07-13 15:42:53 -07:00
committed by gVisor bot
parent 74df310ac0
commit 59a5479409
2 changed files with 8 additions and 7 deletions
-3
View File
@@ -210,9 +210,6 @@ func (t *Timekeeper) startUpdater() {
p.realtimeBaseRef = int64(realtimeParams.BaseRef)
p.realtimeFrequency = realtimeParams.Frequency
}
log.Debugf("Updating VDSO parameters: %+v", p)
return p
}); err != nil {
log.Warningf("Unable to update VDSO parameter page: %v", err)
+8 -4
View File
@@ -228,11 +228,15 @@ func errorAdjust(prevParams Parameters, newParams Parameters, now TSCValue) (Par
//
// The log level is determined by the error severity.
func logErrorAdjustment(clock ClockID, errorNS ReferenceNS, orig, adjusted Parameters) {
fn := log.Debugf
if int64(errorNS.Magnitude()) > time.Millisecond.Nanoseconds() {
magNS := int64(errorNS.Magnitude())
if magNS <= 10*time.Microsecond.Nanoseconds() {
// Don't log small errors.
return
}
fn := log.Infof
if magNS > time.Millisecond.Nanoseconds() {
// Upgrade large errors to warning.
fn = log.Warningf
} else if int64(errorNS.Magnitude()) > 10*time.Microsecond.Nanoseconds() {
fn = log.Infof
}
fn("Clock(%v): error: %v ns, adjusted frequency from %v Hz to %v Hz", clock, errorNS, orig.Frequency, adjusted.Frequency)