A method for calculating latency comprising: receiving, at a latency calculation device, a first enqueue notification of a first enqueue operation from a network device engine, wherein the first enqueue notification comprises a queue identifier associated with a queue and wherein the first enqueue operation corresponds to a first packet being placed into the queue; incrementing, based on the first enqueue notification, an enqueue counter associated with the queue identifier to obtain a current enqueue counter value; determining that a latency calculation flag corresponding to the queue identifier is not set; and based on the determination that the latency calculation flag is not set: determining a first time at which the first enqueue notification of the first enqueue operation was received; storing the first time as a latency start time associated with the queue identifier; storing the current enqueue counter value as a latency start count value; setting the latency calculation flag; receiving a first dequeue notification of a first dequeue operation from the network device engine, wherein the first dequeue notification comprises the queue identifier associated with the queue and wherein the first dequeue operation corresponds to the first packet being removed from the queue; incrementing, based on the first dequeue notification, a dequeue counter associated with the queue identifier to obtain a first current dequeue counter value; determining (334, 336) that the first current dequeue counter value and the latency start count value match; determining a second time at which the notification of the first dequeue operation was received; storing the second time as a latency stop time associated with the queue identifier; removing the latency calculation flag; and calculating a first latency by determining the time difference between the latency start time and the latency stop time. receiving, at a latency calculation device, a first enqueue notification of a first enqueue operation from a network device engine, wherein the first enqueue notification comprises a queue identifier associated with a queue and wherein the first enqueue operation corresponds to a first packet being placed into the queue; incrementing, based on the first enqueue notification, an enqueue counter associated with the queue identifier to obtain a current enqueue counter value; determining that a latency calculation flag corresponding to the queue identifier is not set; and based on the determination that the latency calculation flag is not set: determining a first time at which the first enqueue notification of the first enqueue operation was received; storing the first time as a latency start time associated with the queue identifier; storing the current enqueue counter value as a latency start count value; setting the latency calculation flag; receiving a first dequeue notification of a first dequeue operation from the network device engine, wherein the first dequeue notification comprises the queue identifier associated with the queue and wherein the first dequeue operation corresponds to the first packet being removed from the queue; incrementing, based on the first dequeue notification, a dequeue counter associated with the queue identifier to obtain a first current dequeue counter value; determining (334, 336) that the first current dequeue counter value and the latency start count value match; determining a second time at which the notification of the first dequeue operation was received; storing the second time as a latency stop time associated with the queue identifier; removing the latency calculation flag; and calculating a first latency by determining the time difference between the latency start time and the latency stop time. determining a first time at which the first enqueue notification of the first enqueue operation was received; storing the first time as a latency start time associated with the queue identifier; storing the current enqueue counter value as a latency start count value; setting the latency calculation flag; receiving a first dequeue notification of a first dequeue operation from the network device engine, wherein the first dequeue notification comprises the queue identifier associated with the queue and wherein the first dequeue operation corresponds to the first packet being removed from the queue; incrementing, based on the first dequeue notification, a dequeue counter associated with the queue identifier to obtain a first current dequeue counter value; determining (334, 336) that the first current dequeue counter value and the latency start count value match; determining a second time at which the notification of the first dequeue operation was received; storing the second time as a latency stop time associated with the queue identifier; removing the latency calculation flag; and calculating a first latency by determining the time difference between the latency start time and the latency stop time.