[Lldb-commits] [lldb] r201875 - Improved the GDBRemoteCommunicationClient::TestPacketSpeed() function so it tests how long it takes to send a 4MB buffer from the REMOTE GDB server to LLDB.
Greg Clayton
gclayton at apple.com
Fri Feb 21 11:11:29 PST 2014
Author: gclayton
Date: Fri Feb 21 13:11:28 2014
New Revision: 201875
URL: http://llvm.org/viewvc/llvm-project?rev=201875&view=rev
Log:
Improved the GDBRemoteCommunicationClient::TestPacketSpeed() function so it tests how long it takes to send a 4MB buffer from the REMOTE GDB server to LLDB.
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=201875&r1=201874&r2=201875&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Feb 21 13:11:28 2014
@@ -136,6 +136,11 @@ GDBRemoteCommunicationClient::HandshakeW
// a live connection to a remote GDB server...
if (QueryNoAckModeSupported())
{
+#if 0
+ // Set above line to "#if 1" to test packet speed if remote GDB server
+ // supports the qSpeedTest packet...
+ TestPacketSpeed(10000);
+#endif
return true;
}
else
@@ -2420,50 +2425,81 @@ GDBRemoteCommunicationClient::TestPacket
uint32_t i;
TimeValue start_time, end_time;
uint64_t total_time_nsec;
- float packets_per_second;
if (SendSpeedTestPacket (0, 0))
{
- for (uint32_t send_size = 0; send_size <= 1024; send_size *= 2)
- {
- for (uint32_t recv_size = 0; recv_size <= 1024; recv_size *= 2)
- {
+ static uint32_t g_send_sizes[] = { 0, 64, 128, 512, 1024 };
+ static uint32_t g_recv_sizes[] = { 0, 64, 128, 512, 1024 }; //, 4*1024, 8*1024, 16*1024, 32*1024, 48*1024, 64*1024, 96*1024, 128*1024 };
+ const size_t k_num_send_sizes = sizeof(g_send_sizes)/sizeof(uint32_t);
+ const size_t k_num_recv_sizes = sizeof(g_recv_sizes)/sizeof(uint32_t);
+ const uint64_t k_recv_amount = 4*1024*1024; // Receive 4MB
+ for (uint32_t send_idx = 0; send_idx < k_num_send_sizes; ++send_idx)
+ {
+ const uint32_t send_size = g_send_sizes[send_idx];
+ for (uint32_t recv_idx = 0; recv_idx < k_num_recv_sizes; ++recv_idx)
+ {
+ const uint32_t recv_size = g_recv_sizes[recv_idx];
+ StreamString packet;
+ packet.Printf ("qSpeedTest:response_size:%i;data:", recv_size);
+ uint32_t bytes_left = send_size;
+ while (bytes_left > 0)
+ {
+ if (bytes_left >= 26)
+ {
+ packet.PutCString("abcdefghijklmnopqrstuvwxyz");
+ bytes_left -= 26;
+ }
+ else
+ {
+ packet.Printf ("%*.*s;", bytes_left, bytes_left, "abcdefghijklmnopqrstuvwxyz");
+ bytes_left = 0;
+ }
+ }
+
start_time = TimeValue::Now();
- for (i=0; i<num_packets; ++i)
+ if (recv_size == 0)
+ {
+ for (i=0; i<num_packets; ++i)
+ {
+ StringExtractorGDBRemote response;
+ SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false);
+ }
+ }
+ else
{
- SendSpeedTestPacket (send_size, recv_size);
+ uint32_t bytes_read = 0;
+ while (bytes_read < k_recv_amount)
+ {
+ StringExtractorGDBRemote response;
+ SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false);
+ bytes_read += recv_size;
+ }
}
end_time = TimeValue::Now();
total_time_nsec = end_time.GetAsNanoSecondsSinceJan1_1970() - start_time.GetAsNanoSecondsSinceJan1_1970();
- packets_per_second = (((float)num_packets)/(float)total_time_nsec) * (float)TimeValue::NanoSecPerSec;
- printf ("%u qSpeedTest(send=%-5u, recv=%-5u) in %" PRIu64 ".%9.9" PRIu64 " sec for %f packets/sec.\n",
- num_packets,
- send_size,
- recv_size,
- total_time_nsec / TimeValue::NanoSecPerSec,
- total_time_nsec % TimeValue::NanoSecPerSec,
- packets_per_second);
if (recv_size == 0)
- recv_size = 32;
+ {
+ float packets_per_second = (((float)num_packets)/(float)total_time_nsec) * (float)TimeValue::NanoSecPerSec;
+ printf ("%u qSpeedTest(send=%-7u, recv=%-7u) in %" PRIu64 ".%9.9" PRIu64 " sec for %f packets/sec.\n",
+ num_packets,
+ send_size,
+ recv_size,
+ total_time_nsec / TimeValue::NanoSecPerSec,
+ total_time_nsec % TimeValue::NanoSecPerSec,
+ packets_per_second);
+ }
+ else
+ {
+ float mb_second = ((((float)k_recv_amount)/(float)total_time_nsec) * (float)TimeValue::NanoSecPerSec) / (1024.0*1024.0);
+ printf ("%u qSpeedTest(send=%-7u, recv=%-7u) sent 4MB in %" PRIu64 ".%9.9" PRIu64 " sec for %f MB/sec.\n",
+ num_packets,
+ send_size,
+ recv_size,
+ total_time_nsec / TimeValue::NanoSecPerSec,
+ total_time_nsec % TimeValue::NanoSecPerSec,
+ mb_second);
+ }
}
- if (send_size == 0)
- send_size = 32;
- }
- }
- else
- {
- start_time = TimeValue::Now();
- for (i=0; i<num_packets; ++i)
- {
- GetCurrentProcessID ();
}
- end_time = TimeValue::Now();
- total_time_nsec = end_time.GetAsNanoSecondsSinceJan1_1970() - start_time.GetAsNanoSecondsSinceJan1_1970();
- packets_per_second = (((float)num_packets)/(float)total_time_nsec) * (float)TimeValue::NanoSecPerSec;
- printf ("%u 'qC' packets packets in 0x%" PRIu64 "%9.9" PRIu64 " sec for %f packets/sec.\n",
- num_packets,
- total_time_nsec / TimeValue::NanoSecPerSec,
- total_time_nsec % TimeValue::NanoSecPerSec,
- packets_per_second);
}
}
More information about the lldb-commits
mailing list