I have a开发者_开发问答 python script, that uses libpcap (pcapy) to capture some specific packets, for example, packets from 10.1.1.1 to 10.2.2.2. Is it possible to measure that data transfer rate? I mean, we can get a size of packet, but as I understand, we can't find out how long did it take to transfer that packet. Is there some another way to measure packet rate?
You could use time
to time how long it takes to get the packet:
import time
start = time.time()
# do something you want to time
elapsed = time.time() - start
精彩评论