How to measure data sent when I have a dump file created by tcpdump
You are right, the file size does not reflect the amount of data transmitted: the pcap format contains extra metadata.
One nice tool to get actual data size is using capinfos which is part of the wireshark-common
package.
Example output, notice the Data size value:
$ capinfos plop.pcap
File name: plop.pcap
File type: Wireshark/tcpdump/... - pcap
File encapsulation: Linux cooked-mode capture
File timestamp precision: microseconds (6)
Packet size limit: file hdr: 262144 bytes
Number of packets: 2049
File size: 335 kB
Data size: 302 kB
Capture duration: 88.022993 seconds
First packet time: 2017-08-22 09:48:45.233556
Last packet time: 2017-08-22 09:50:13.256549
Data byte rate: 3442 bytes/s
Data bit rate: 27 kbps
Average packet size: 147.88 bytes
Average packet rate: 23 packets/s
SHA1: 51ce5b43206995385ef7f95948848cf6a869367e
RIPEMD160: fe861b6f16816d952c7a6c88bec63cb30246d125
MD5: 5ee593b0a5631c42cfebdc20ff0086e7
Strict time order: False
Number of interfaces in file: 1
Interface #0 info:
Encapsulation = Linux cooked-mode capture (25/113 - linux-sll)
Capture length = 262144
Time precision = microseconds (6)
Time ticks per second = 1000000
Number of stat entries = 0
Number of packets = 2049
You could open the dump file with wireshark to use it's filters and statistics for getting what you want. To see instructions regarding the filtering see this page from wireshark forum: https://ask.wireshark.org/questions/9805/measure-the-total-transmitted-byte-in-a-time-interval