void Connection::calcStats() { int elapsed = m_statstimer_mark.restart(); // ms since last calc m_stats_tx_bytes_per_sec = (float)1000 * ( (m_tx_bytes - m_tx_bytes_last) / (float)elapsed ); m_stats_rx_bytes_per_sec = (float)1000 * ( (m_rx_bytes - m_rx_bytes_last) / (float)elapsed ); m_rx_bytes_last = m_rx_bytes; m_tx_bytes_last = m_tx_bytes; emit statsTick( m_stats_tx_bytes_per_sec, m_stats_rx_bytes_per_sec ); }
void Connection::calcStats() { Q_D( Connection ); int elapsed = d->statstimer_mark.restart(); // ms since last calc d->stats_tx_bytes_per_sec = (float)1000 * ( (d->tx_bytes - d->tx_bytes_last) / (float)elapsed ); d->stats_rx_bytes_per_sec = (float)1000 * ( (d->rx_bytes - d->rx_bytes_last) / (float)elapsed ); d->rx_bytes_last = d->rx_bytes; d->tx_bytes_last = d->tx_bytes; emit statsTick( d->stats_tx_bytes_per_sec, d->stats_rx_bytes_per_sec ); }