| 735 | |
| 736 | |
| 737 | GraphUpdateInfo CStatistics::GetPointsForUpdate() |
| 738 | { |
| 739 | GraphUpdateInfo update; |
| 740 | listPOS phr = --listHR.end(); |
| 741 | update.timestamp = (double) phr->sTimestamp; |
| 742 | |
| 743 | m_graphRunningAvgDown += (uint32)(phr->kBpsDownCur * 1024.0); |
| 744 | m_graphRunningAvgUp += (uint32)(phr->kBpsUpCur * 1024.0); |
| 745 | // Note: kadNodesCur is multiplied by 1024 since the value is done |
| 746 | // in other places, so we simply follow suit here to avoid trouble. |
| 747 | m_graphRunningAvgKad += (uint32)(phr->kadNodesCur * 1024.0); |
| 748 | m_graphRunningAvgDown.CalculateRate((uint64)(phr->sTimestamp * 1000.0)); |
| 749 | m_graphRunningAvgUp.CalculateRate((uint64)(phr->sTimestamp * 1000.0)); |
| 750 | m_graphRunningAvgKad.CalculateRate((uint64)(phr->sTimestamp * 1000.0)); |
| 751 | |
| 752 | update.downloads[0] = phr->kBytesReceived / phr->sTimestamp; |
| 753 | update.downloads[1] = m_graphRunningAvgDown.GetRate() / 1024.0; |
| 754 | update.downloads[2] = phr->kBpsDownCur; |
| 755 | |
| 756 | update.uploads[0] = phr->kBytesSent / phr->sTimestamp; |
| 757 | update.uploads[1] = m_graphRunningAvgUp.GetRate() / 1024.0; |
| 758 | update.uploads[2] = phr->kBpsUpCur; |
| 759 | |
| 760 | update.connections[0] = (float)phr->cntUploads; |
| 761 | update.connections[1] = (float)phr->cntConnections; |
| 762 | update.connections[2] = (float)phr->cntDownloads; |
| 763 | |
| 764 | update.kadnodes[0] = phr->kadNodesTotal / phr->sTimestamp; |
| 765 | update.kadnodes[1] = m_graphRunningAvgKad.GetRate() / 1024.0; |
| 766 | update.kadnodes[2] = phr->kadNodesCur; |
| 767 | |
| 768 | return update; |
| 769 | } |
| 770 | |
| 771 | |
| 772 | /* ------------------------------- TREE ---------------------------- */ |
no test coverage detected