code: func (s *stateSync) updateStats(written, duplicate, unexpected int, duration time.Duration) {
  	s.d.syncStatsLock.Lock()
  	defer s.d.syncStatsLock.Unlock()
  
  	s.d.syncStatsState.pending = uint64(s.sched.Pending())
  	s.d.syncStatsState.processed += uint64(written)
  	s.d.syncStatsState.duplicate += uint64(duplicate)
  	s.d.syncStatsState.unexpected += uint64(unexpected)
  
  	if written > 0 || duplicate > 0 || unexpected > 0 {
  		log.Info("Imported new state entries", "count", written, "elapsed", common.PrettyDuration(duration), "processed", s.d.syncStatsState.processed, "pending", s.d.syncStatsState.pending, "retry", len(s.tasks), "duplicate", s.d.syncStatsState.duplicate, "unexpected", s.d.syncStatsState.unexpected)
  	}
  	if written > 0 {
  		rawdb.WriteFastTrieProgress(s.d.stateDB, s.d.syncStatsState.processed)
  	}
  }
docs: // updateStats bumps the various state sync progress counters and displays a log
  // message for the user to see.