Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ilko Iliev <iliev@ronetix.at>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sources.redhat.com
Subject: Re: "Transfer rate" patch
Date: Sun, 10 Sep 2006 18:50:00 -0000	[thread overview]
Message-ID: <45045E5E.6020602@ronetix.at> (raw)
In-Reply-To: <200609071954.k87Js9sd022237@elgar.sibelius.xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

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



[-- Attachment #2: gdb_download_speed.patch --]
[-- Type: text/plain, Size: 2004 bytes --]

--- 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);


  reply	other threads:[~2006-09-10 18:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-05  7:25 Ilko Iliev
2006-09-05 18:03 ` Michael Snyder
2006-09-06  7:11 ` Vladimir Prus
2006-09-07 14:20   ` Ilko Iliev
2006-09-07 14:58     ` Vladimir Prus
2006-09-07 19:54     ` Mark Kettenis
2006-09-10 18:50       ` Ilko Iliev [this message]
2006-10-17 16:04         ` Andrew STUBBS
2006-10-17 16:08           ` Daniel Jacobowitz
2006-09-07 14:44   ` Andrew STUBBS

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45045E5E.6020602@ronetix.at \
    --to=iliev@ronetix.at \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox