Project

General

Profile

Actions

Bug #52

closed

Fix throughput computation of uwcbr and uwapplication modules

Added by Vincenzo Cimino about 1 month ago. Updated 21 days ago.

Status:
Closed
Priority:
High
Target version:
Start date:
03/27/2026
Due date:
% Done:

0%

Estimated time:

Description

Upon repection of a new packet, both UwCBRModule and UwApplicationModule store the amount of received bytes so far and the sum of the delays:

UwCbrModule::recv(Packet *p)
{
    // ... 
    double dt = NOW - lrtime;
    updateThroughput(ch->size(), dt);

    lrtime = NOW;
    // ...
}

UwCbrModule::updateThroughput(const int &bytes, const double &dt)
{
	sumbytes += bytes;
	sumdt += dt;
}

This method:

UwCbrModule::GetTHR() const
{
	return ((sumdt != 0) ? sumbytes * 8 / sumdt : 0);
}

Should compute the throughput as the bytes received over the elapsed time. The problem is that sumdt is updated only when a packet is received.
Suppose now that I want to compute the throughput at the end of the simulation, but since half of the simulation time I haven't received any packet, the throughput computed is wrong.
A possible solution is:

double
UwCbrModule::GetTHR() const
{
	return (NOW > 0) ? sumbytes * 8 / NOW : 0;
}

This computes the throughput with respect to the start of simulation.

Actions

Also available in: Atom PDF