title: how to calculate the received packets rate on a linux based pc?like pps or fps
body: <p>I am writing a network program which can calculate accurate data packet rate (packet per second, frame per second, bps). Now i have a device called testcenter which can send accurate flow to a specific pc (protocol is UDP/IP) on Linux, i like to  know the accurate pps(packets per second) with my program , i have considered the <code>gettimeofday(&amp;start,NULL)</code>function before i call <code>recvfrom()</code> and update the counter for packets, after that call <code>gettimeofday(&amp;end,NULL)</code> and get the pps rate. I hope there is better solution than this since the user/kernel barrier is traversed on system calls.
  Best regards.</p>