From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9716 invoked by alias); 6 Sep 2006 07:11:42 -0000 Received: (qmail 9708 invoked by uid 22791); 6 Sep 2006 07:11:40 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 06 Sep 2006 07:11:37 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GKrZF-0005pU-Ee for gdb-patches@sources.redhat.com; Wed, 06 Sep 2006 09:11:26 +0200 Received: from wind.lvk.cs.msu.su ([158.250.17.9]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Sep 2006 09:11:25 +0200 Received: from ghost by wind.lvk.cs.msu.su with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Sep 2006 09:11:25 +0200 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: "Transfer rate" patch Date: Wed, 06 Sep 2006 07:11:00 -0000 Message-ID: References: <44FD2640.7080605@ronetix.at> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit User-Agent: KNode/0.10.2 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00020.txt.bz2 Ilko Iliev wrote: > "Transfer rate" patch > From: > Ilko Iliev > 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