add reporting of changes since last request

This commit is contained in:
Andreas Gocht-Zech
2023-08-20 22:07:43 +02:00
parent b581af6990
commit 668ae29c0a
5 changed files with 31 additions and 0 deletions

View File

@@ -192,6 +192,20 @@ void Process::gettotalb(float *recvd, float *sent) {
*recvd = sum_recv;
}
/** get only bytes since last request */
void Process::getlast(u_int64_t *recvd, u_int64_t *sent) {
u_int64_t sum_sent = 0, sum_recv = 0;
gettotal(&sum_recv, &sum_sent);
*sent = sum_sent - this->sent_last_reported;
*recvd = sum_recv - this->rcvd_last_reported;
this->sent_last_reported = *sent;
this->rcvd_last_reported = *recvd;
}
Process *findProcess(struct prg_node *node) {
ProcList *current = processes;
while (current != NULL) {