Performance statistics
Finally got some performance information out of NS-2/NSC. Didn’t manage to get profiling working at all, on my FreeBSD 5.1 computer in uni the link failed because it couldn’t find -lstdc++_p. Whatever that is. Couldn’t find any references to it on google.
I looked through the code to see where the data copies happen. I came up with the following findings: SENDING:
sim: write data to socket * stack: buffer data in socket buffer [data now held by stack. Eventually a packet will be sent] g_if_send_packet BSDStack::if_send_packet_mbuf * - m_copydata (copies entire packet data) sim: BSDAgent::send_callback * - memcpy (copies entire packet data) [memory now handled by simulation]
RECEIVING
sim: BSDAgent::recv stack: BSDStack::if_receive_packet fake_ether_input * - m_copyback (copies entire packet) netisr_dispatch [memory now handled by stack] sim: read * copy data into read buffer
The * indicates where there is a data copy. So I went through and changes copying so only a maximum of 100 bytes is copied, where normally there would be up to 1500 bytes copied. I haven’t changed reading/writing to sockets yet, the full amount of data is copied in those situations.
I only got a small performance increase. Quite suprising! I wish I could profile the application. The following graph shows the differences in times: Graph.
Note: my new simulation framework was very useful here, it validated the simulations; the results are exactly the same with my news performance changes.