A traffic statistics collection method, performed by a modem of a terminal device, comprising: when the modem detects a first Internet Protocol, IP, packet, obtaining a first IP address of the first IP packet, and obtaining a packet length of the first IP packet (101, 403); obtaining (102, 404), by the modem from an in-memory database, an access point name, APN, corresponding to the first IP address of the first IP packet; and when the APN corresponding to the first IP address of the first IP packet is an APN of a first public data network, PDN, adding, by the modem, the packet length of the first IP packet to a first statistics value of voice over Long Term Evolution, LTE, VoLTE traffic, wherein the first PDN is a PDN required by a bearer that establishes a VoLTE service (103, 404). wherein before the detecting, by the modem, a first Internet Protocol, IP, packet, the method further comprises: obtaining, by the modem, an IP address of the first PDN; and storing, by the modem, the IP address of the first PDN and the APN of the first PDN corresponding to each other in the in-memory database, wherein the obtaining, by the modem, an IP address of the first PDN comprises: sending, by the modem, a first PDN registration request to a network side, wherein the first PDN registration request comprises the APN of the first PDN, so that the network side obtains the IP address of the first PDN according to the APN of the first PDN; and receiving, by the modem, the IP address of the first PDN that is sent by the network side. when the modem detects a first Internet Protocol, IP, packet, obtaining a first IP address of the first IP packet, and obtaining a packet length of the first IP packet (101, 403); obtaining (102, 404), by the modem from an in-memory database, an access point name, APN, corresponding to the first IP address of the first IP packet; and when the APN corresponding to the first IP address of the first IP packet is an APN of a first public data network, PDN, adding, by the modem, the packet length of the first IP packet to a first statistics value of voice over Long Term Evolution, LTE, VoLTE traffic, wherein the first PDN is a PDN required by a bearer that establishes a VoLTE service (103, 404). wherein before the detecting, by the modem, a first Internet Protocol, IP, packet, the method further comprises: obtaining, by the modem, an IP address of the first PDN; and storing, by the modem, the IP address of the first PDN and the APN of the first PDN corresponding to each other in the in-memory database, obtaining, by the modem, an IP address of the first PDN; and storing, by the modem, the IP address of the first PDN and the APN of the first PDN corresponding to each other in the in-memory database, wherein the obtaining, by the modem, an IP address of the first PDN comprises: sending, by the modem, a first PDN registration request to a network side, wherein the first PDN registration request comprises the APN of the first PDN, so that the network side obtains the IP address of the first PDN according to the APN of the first PDN; and receiving, by the modem, the IP address of the first PDN that is sent by the network side. sending, by the modem, a first PDN registration request to a network side, wherein the first PDN registration request comprises the APN of the first PDN, so that the network side obtains the IP address of the first PDN according to the APN of the first PDN; and receiving, by the modem, the IP address of the first PDN that is sent by the network side.