In a metropolitan area network, a method and system for maintaining an accurate
total of the amount of allocated bandwidth on the network. A plurality of incoming
packets are assigned to a respective plurality of queues of a metropolitan area
network switch. Using a fair arbitration scheme, the respective queues are configured
to empty at a specified output rate. A finish time for each respective queue is
computed, the finish time describing a time at which the respective queue will
be emptied using the output rate. The plurality of queues are grouped into multiple
groups in accordance with their respective finish times. The earliest group includes
the reserved rates of those queues having a finish time indicating an empty condition
at a first time increment. The second earliest group includes the reserved rates
of those queues having a finish time indicating an empty condition at a second
time increment later than the first time increment, and so on. The amount of allocated
bandwidth on the network is determined by tracking the sum of the reserved rates
of all the multiple groups. The first time increment, second time increment, and
the like are indexed with respect to a schedule clock. The earliest group thus
indicates those queues that will have an empty condition at a next time increment
of the schedule clock. The determination of the amount of allocated bandwidth can
be accomplished in real time, thereby allowing the efficient allocation of unallocated
bandwidth in real time.