> hi, > I just checked the two mechanism : > (1) Using mmap to fetch packets from kernel to userspace > (2) Using recvfrom() call to fetch packets > > I see top reports > (1) 34% memory 20% cpu usage > (2) 21% memory 7% cpu usage !
It is worth remembering that the cpu usage reported by top isn't worth the paper it is printed on for many workloads. IIRC it is based on the cpu state when the timer interrupt fires. processes that are scheduled very often, and run for short periods tend to get mis-counted. Since the Linux scheduler doesn't get a high-res timestamp everytime it does a process switch, about the only way to measure idle time is to put a very low priority process into a counting loop. Unfortunately the scheduler might make it difficult to make the processes priority low enough. David _______________________________________________ tcpdump-workers mailing list tcpdump-workers@lists.tcpdump.org https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers