This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: "Transfer rate" patch
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 06 Sep 2006 11:11:07 +0400
- Subject: Re: "Transfer rate" patch
- References: <44FD2640.7080605@ronetix.at>
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