I would like to record the total number of bytes transferred over the network by different versions of VNC. My plan is to start the VNC viewer, run a script remotely that performs some actions and displays some graphics and then disconnects.

How can you record the total network usage of just this one process in linux? I don't want to measure anything else that is happening on the system.

有帮助吗?

解决方案

You could run the different versions of the VNC viewers on different port numbers and then record all traffic to those ports with a tool such as tcpdump.

There may be some way of recording traffic per process but doing it by port is much more obvious and simple

crude example using perl to add up/filter

sudo tcpdump -li eth1 ' port 5900'|perl -ne 'print $c,"\n"; $c+=$1 if (/length (\d+)/);'

其他提示

You should try iftop Linux command.

$ sudo iftop -i eth0 -P
server.example.com:ssh     => client.example.com:51365         1.73kb  2.72kb  2.72kb

More elegant way using filters:

$sudo iftop -i eth0 -f "dst port 22"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top