From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: "Linus Lüssing" <linus.luessing@c0d3.blue>,
"Marek Lindner" <mareklindner@neomailbox.ch>,
"txt.file" <txt.file@txtfile.eu>
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: Mon, 21 May 2018 21:06:26 +0200 [thread overview]
Message-ID: <1883169.6MDR23bMJo@sven-edge> (raw)
In-Reply-To: <20180521131711.GK7162@otheros>
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
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.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-05-21 19:06 UTC|newest]
Thread overview: 27+ 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 [this message]
2018-08-04 9:31 ` Antonio Quartulli
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
2018-08-04 9:02 ` Sven Eckelmann
2018-08-04 9:08 ` 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=1883169.6MDR23bMJo@sven-edge \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=linus.luessing@c0d3.blue \
--cc=mareklindner@neomailbox.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).