All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <a@unstable.cc>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>,
	Sven Eckelmann <sven@narfation.org>
Cc: "txt.file" <txt.file@txtfile.eu>,
	Marek Lindner <mareklindner@neomailbox.ch>
Subject: Re: [B.A.T.M.A.N.] [PATCH v2 6/7] batman-adv: ELP - use tp meter to estimate the throughput if otherwise not available
Date: Sat, 4 Aug 2018 17:31:27 +0800	[thread overview]
Message-ID: <41a3ff9a-d673-7114-f32b-5644e21b02cc@unstable.cc> (raw)
In-Reply-To: <1883169.6MDR23bMJo@sven-edge>


[-- Attachment #1.1: Type: text/plain, Size: 2304 bytes --]

Hi,

On 22/05/18 03:06, Sven Eckelmann wrote:
> On Montag, 21. Mai 2018 15:17:11 CEST Linus Lüssing wrote:
>>> +               throughput = total_bytes * 8 >> ilog2(test_time) / 10;
> [...]
>> -----
> [...]
>>
>>         throughput = total_bytes * 8 >> log_test_time / 10;
>>
>>         // Straightforward approach?
>>         throughput2 = total_bytes * 8 / test_time * 1000 / 1024 / 100;
> [...]
>> -----
>> $ ./test
>> Result: 80000000 (log_test_time: 13)
>> Result2: 156
>> $ file ./test
>> ./test: ELF 32-bit LSB pie executable ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=d18f32829cdd2bc42cf744cdcafde7cdbd315cb0, not stripped
>> -----
> 
> Thanks for this small example program. Yes, there are parenthesis missing in 
> the calculation. Right now, following is calculated:
> 
>     (total_bytes * 8) >> (ilog2(test_time) / 10);
> 
> But the author most likely wanted following precedence:
> 
>     ((total_bytes * 8) >> ilog2(test_time)) / 10;
> 
> And together with the fixed unit, you would get:
> 
>     (total_bytes * 8 >> ilog2(test_time) / 100;
> 
> Your example program would then show following result because the shifting 
> stuff is still the wrong approach:
> 
>     Result: 195 (log_test_time: 13)
>     Result2: 156
> 
> The calculation still has to be changed to something like this to get 
> 
>     // when 0.1 Mbit/s == 100 kbit/s
>     throughput = total_bytes * 5;
> 	 do_div(throughput, test_time * 64);
> 
>     // when 0.1 Mbit/s == 102.4 kbit/s
>     throughput = total_bytes * 625;
> 	 do_div(throughput, test_time * 8192);
> 
>     // when 0.1 Mbit/s == 100 kbit/s, and 1kbit/s == 1000 bit (instead of 1024 bit):
>     throughput = total_bytes;
>     do_div(throughput, test_time * 125);
> 
> Please keep in mind that we must do a check of the divisor (for 0) before 
> doing this do_div.

Thanks for the code and the correction :-)

Yes, we wanted to avoid 64 bits explicit divisions and we assumed
test_time would have been a power of 2 (otherwise we'd accept a small
error).

Anyway, the last case brought by Sven depicts what we want to implement.
The patch will be changed accordingly.

Cheers,

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-08-04  9:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18  1:47 [B.A.T.M.A.N.] [PATCH v2 0/7] B.A.T.M.A.N. V - fallback to tp meter estimation if throughput otherwise not available Marek Lindner
2018-05-18  1:47 ` [B.A.T.M.A.N.] [PATCH v2 1/7] batman-adv: tp_meter - prevent concurrent tp_meter sessions by using workqueue Marek Lindner
2018-08-29  6:56   ` Sven Eckelmann
2018-05-18  1:47 ` [B.A.T.M.A.N.] [PATCH v2 2/7] batman-adv: tp_meter - don't check for existing session Marek Lindner
2018-05-18  1:47 ` [B.A.T.M.A.N.] [PATCH v2 3/7] batman-adv: tp_meter - allow up to 10 queued sessions Marek Lindner
2018-05-18  1:47 ` [B.A.T.M.A.N.] [PATCH v2 4/7] batman-adv: tp_meter - add caller distinction Marek Lindner
2018-05-18  1:47 ` [B.A.T.M.A.N.] [PATCH v2 5/7] batman-adv: tp_meter - add option to perform one-hop test Marek Lindner
2018-05-18  1:47 ` [B.A.T.M.A.N.] [PATCH v2 6/7] batman-adv: ELP - use tp meter to estimate the throughput if otherwise not available Marek Lindner
2018-05-21 13:17   ` Linus Lüssing
2018-05-21 17:51     ` Sven Eckelmann
2018-05-21 19:06     ` Sven Eckelmann
2018-08-04  9:31       ` Antonio Quartulli [this message]
2018-05-21 14:43   ` Linus Lüssing
2018-08-04  9:35     ` Marek Lindner
2018-05-21 14:48   ` Linus Lüssing
2018-08-04  9:39     ` Antonio Quartulli
2018-05-21 15:01   ` Linus Lüssing
2018-08-04  8:59     ` Antonio Quartulli
2018-05-21 16:36   ` Sven Eckelmann
2018-05-18  1:47 ` [B.A.T.M.A.N.] [PATCH v2 7/7] batman-adv: ELP - add throughput meter test duration attribute Marek Lindner
2018-05-21 13:46   ` Linus Lüssing
2018-05-21 13:57     ` Linus Lüssing
2018-08-04  9:05     ` Marek Lindner
2018-05-21 14:34   ` Sven Eckelmann
2018-08-04  8:41     ` Antonio Quartulli
     [not found]       ` <314bf0ac-4c10-da7a-d527-45afe92423fa-2CpIooy/SPIKlTDg6p0iyA@public.gmane.org>
2018-08-04  9:02         ` Sven Eckelmann
2018-08-04  9:02           ` [B.A.T.M.A.N.] " Sven Eckelmann
2018-08-04  9:08           ` Antonio Quartulli
2018-08-04  9:08             ` [B.A.T.M.A.N.] " Antonio Quartulli

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=41a3ff9a-d673-7114-f32b-5644e21b02cc@unstable.cc \
    --to=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=sven@narfation.org \
    --cc=txt.file@txtfile.eu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.