摘要 |
Disclosed are a traffic statistics collection method and apparatus. In the method, an input control parameter for each type of packets in N types of packets is set by using a same counter, N being a positive integer and greater than or equal to 2, each input control parameter being a positive integer and the N input control parameters being different from one another; when a first preset time point is reached, N count values are acquired from the counter, the N count values comprising a sum of the number of the N types of packets received by a preset port at the first preset time point and (N-1) input control parameter counts, each input control parameter count being linearly correlated with input control parameters of (N-1) types of packets selected from the N types of packets, and being partially same as the (N-1) types of packets corresponding to each input control parameter count; and statistics on the traffic of each type of packets in the N types of packets at the first preset time point are collected according to the N input control parameters and the N count values, thereby saving the counter resource. |