We are developing a custom board based on Cyclone V. It is a FPGA+ARM Soc running embedded Linux kernel 3.10-ltsi. Our intended application is to send over a chunk of raw huge data reside in memory, in the range of 50-400MB, to a Java client running on Windows 7, via TCP gigabit ethernet. iperf shows that our board's TCP throughput is in the range of 6xxMBit/s. Questions: 1.We have a requirement where we need to send over the raw memory data within certain interval. So what is the proper way to measure the throughput for our case? Currently we are just wrapping the sending code with gettimeofday like this:
int total_sent = 0, bytes_sent = 0;
gettimeofday(&t0, 0);
for (total_sent = 0; total_sent < data_size;) {
bytes_sent = write(conn_fd, buf + total_sent, data_size - total_sent);
if (bytes_sent == -1)
break;
total_sent += bytes_sent;
}
gettimeofday(&t1, 0);
unsigned long elapsed_us = (t1.tv_sec - t0.tv_sec) * 1000000 + t1.tv_usec - t0.tv_usec;
double elapsed_s = (double)elapsed_us / 1000000;
printf("Throughput: %f Mbit/s\n", img_size * 8 / elapsed_s / 1000000);
printf("Total bytes sent: %d\n", total_sent);
Is this a correct method to measure the throughput?
2.Is it possible to increase the throughput via two ethernet ports? Something like slicing the raw data into two parts and send it over two ports.
3.What is the best method to increase the throughput in our case? The maximum throughput we would like to achieve is 1024MBit/s.