This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "Transfer rate" patch


What happened to this patch? This is one I would like to see.

Ilko Iliev wrote:
Mark Kettenis wrote:
Date: Thu, 07 Sep 2006 16:20:35 +0200
From: Ilko Iliev <iliev@ronetix.at>

The corrected patch again - the output is in "KBytes/sec" or "bytes/sec".
The ChangeLog file is updated too.


I changed to "KBytes/sec" because of our and other fast JTAG Emulators.

Well 9600 Bps is still pretty much standard for serial lines.


Mark

Even of 9600 Bps it is more comfortable to see the download sped in KBytes/s.
If the download speed is less than 1 KByte/s, the print is in bytes/s.


In the attachment is the corrected version of the patch.


regards, Ilko Iliev Ronetix - JTAG Emulators and Flash Programmers www.ronetix.at



------------------------------------------------------------------------

--- ChangeLog.orig 2006-09-07 15:23:19.000000000 +0200
+++ ChangeLog 2006-09-07 15:27:46.000000000 +0200
@@ -1,3 +1,8 @@
+2006-09-07 Ilko Iliev <iliev@ronetix.at>
+
+ * symfile.c (print_transfer_performance): Fix overflow problem
+ and change bits/sec to KBytes/sec or bytes/sec
+
2006-08-28 DJ Delorie <dj@redhat.com>
* m32c-tdep.c (m32c_decode_srcdest4): Initialize fields in sd




--- symfile.c.orig 2006-08-31 15:29:12.000000000 +0200
+++ symfile.c 2006-09-07 17:23:48.000000000 +0200
@@ -1758,27 +1758,36 @@ print_transfer_performance (struct ui_fi
unsigned long write_count,
const struct timeval *start_time,
const struct timeval *end_time)
{
unsigned long time_count;
+ unsigned long rr;
/* Compute the elapsed time in milliseconds, as a tradeoff between
accuracy and overflow. */
time_count = (end_time->tv_sec - start_time->tv_sec) * 1000;
time_count += (end_time->tv_usec - start_time->tv_usec) / 1000;
ui_out_text (uiout, "Transfer rate: ");
if (time_count > 0)
{
- ui_out_field_fmt (uiout, "transfer-rate", "%lu",
- 1000 * (data_count * 8) / time_count);
- ui_out_text (uiout, " bits/sec");
+ rr = (unsigned long)((unsigned long long)data_count * 1000 / time_count);
+ if ( rr < 1024 )
+ {
+ ui_out_field_fmt (uiout, "transfer-rate", "%lu", rr );
+ ui_out_text (uiout, " bytes/sec");
+ }
+ else
+ {
+ ui_out_field_fmt (uiout, "transfer-rate", "%lu", rr / 1024 );
+ ui_out_text (uiout, " Kbytes/sec");
+ }
}
else
{
- ui_out_field_fmt (uiout, "transferred-bits", "%lu", (data_count * 8));
- ui_out_text (uiout, " bits in <1 sec");
+ ui_out_field_fmt (uiout, "transferred-bytes", "%lu", data_count);
+ ui_out_text (uiout, " bytes in <1 sec");
}
if (write_count > 0)
{
ui_out_text (uiout, ", ");
ui_out_field_fmt (uiout, "write-rate", "%lu", data_count / write_count);




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]