From: Ilko Iliev <iliev@ronetix.at>
To: Vladimir Prus <ghost@cs.msu.su>
Cc: gdb-patches@sources.redhat.com
Subject: "Transfer rate" patch
Date: Thu, 07 Sep 2006 14:20:00 -0000 [thread overview]
Message-ID: <45002AB3.7090402@ronetix.at> (raw)
In-Reply-To: <edlsab$kvl$1@sea.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2153 bytes --]
Hi,
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.
regards,
Ilko Iliev
Ronetix - JTAG Emulators and Flash Programmers
www.ronetix.at
Vladimir Prus wrote:
> Ilko Iliev wrote:
>
>
>> "Transfer rate" patch
>> From:
>> Ilko Iliev <office@ronetix.at>
>> Date:
>> Tuesday 05 September 2006 11:24:48
>> Groups:
>> gmane.comp.gdb.patches
>> Hi,
>>
>> I found a small bug by the calculating of the transfer rate at the
>> "load" command - if the download image size or the download speed is
>> higher then occurs overflow and the printed information is wrong.
>>
>> I attached a patch for this problem.
>>
>>
>> regards,
>> Ilko Iliev
>> www.ronetix.at
>> gdb_download_speed.patch
>> --- symfile.c.orig 2006-08-31 15:29:12.000000000 +0200
>> +++ symfile.c 2006-08-31 15:47:28.000000000 +0200
>> @@ -1769,14 +1769,14 @@
>> 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");
>> + ui_out_field_fmt (uiout, "transfer-rate", "%lu",
>> + (unsigned long)((((unsigned long
>> long)data_count)*1000)/time_count)/1024); + ui_out_text (uiout, "
>> Kbytes/sec"); }
>>
>
> I am not sure about motivation to switch to "Kbytes/sec" -- I've seen a
> target that does 700 *bytes* per second, so your code will just print '0'
> in that case -- is that intended?
>
>
>> 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-bits", "%lu", data_count);
>> + ui_out_text (uiout, " bytes in <1 sec");
>>
>
> You've changed the code to output the number of bytes and changes the text
> to read "bytes" the the name of output field is still 'transferred-bits'.
> I'm not sure this matters (maybe in MI mode), but in any way, you should
> adjust that.
>
>
> - Volodya
>
>
[-- Attachment #2: gdb_download_speed.patch --]
[-- Type: text/plain, Size: 1523 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 15:19:45.000000000 +0200
@@ -1769,14 +1769,23 @@
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");
+ if ( data_count < 1024 )
+ {
+ ui_out_field_fmt (uiout, "transfer-rate", "%lu",
+ (unsigned long)((((unsigned long long)data_count) * 1000) / time_count));
+ ui_out_text (uiout, " bytes/sec");
+ }
+ else
+ {
+ ui_out_field_fmt (uiout, "transfer-rate", "%lu",
+ (unsigned long)((((unsigned long long)data_count) * 1000) / time_count) / 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)
{
next prev parent reply other threads:[~2006-09-07 14:20 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 [this message]
2006-09-07 14:58 ` Vladimir Prus
2006-09-07 19:54 ` Mark Kettenis
2006-09-10 18:50 ` Ilko Iliev
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=45002AB3.7090402@ronetix.at \
--to=iliev@ronetix.at \
--cc=gdb-patches@sources.redhat.com \
--cc=ghost@cs.msu.su \
/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