1. A method performed by an application program interface (API), the method comprising: reading a count value from a hardware counter in a network device; resetting the hardware counter; and updating a software counter with the count value, said software counter being stored in a memory location in a memory, said memory location corresponding to the hardware counter, and said memory being accessible both by the API and an application program using the API.