Comments (4)
After some investigation, I need to say that the previous formula all_time_upload / total_done
is close to the correct answer and is an expected way to calculate the ratio
.
For each torrent session, we have:
total_upload
,total_download
- the number of bytes downloaded and uploaded to all peers, accumulated, this session only. The session restarts when a torrent is paused and restarted again. When a torrent is paused, these counters are reset to 0.total_payload_download,
total_payload_upload
- the number of bytes sent and received this session, but only the actual payload data, ignoring any protocol overhead. When a torrent is paused, these counters are reset to 0.all_time_upload
andall_time_download
- are accumulated byte counters; they are saved in and restored from resume data to keep totals across sessions.total_done
- the total number of bytes of the file(s) that we have. All this does not necessarily have to be downloaded during this session.
The ratio
value is commonly considered as (uploaded / downloaded)
, where the exact meaning of "uploaded" and "downloaded" can differ slightly depending on a specific corner case and a specific torrent client.
- When a user pauses and restarts a torrent several times, he still expects the ratio to be calculated over all session restarts, so
total_upload
andtotal_download
are unsuitable. all_time_upload
andall_time_download
suits better, but we should not include protocol overhead and rejected blocks that failed integrity checks in the total download. Usingall_time_download
could potentially inflate the download portion of the ratio if some torrent pieces were downloaded multiple times due to errors or incomplete transfers. Therefore,total_done
is the most suitable counter for theratio
calculation.
But I agree that the calculated ratio
does not match with the up
/ down
counters because counters currently only display the data for the current session (after the torrent was unpaused). To fix it, we should also display the total number of uploaded/downloaded bytes.
So, the torrent statistics can be displayed as:
Ratio: 0.1, up: 1 MB (total 100 MB), down: 2 MB (total 1 GB)
This should remove user confusion, as the ratio
is calculated for totals that will be displayed now.
There is a corner case that is not correctly handled by the current formula: when a user seeds a pre-downloaded torrent, and the total_done
counter is 0
, the ratio
is calculated as 0
. It should be ♾ or "MAX" instead because 0
has the opposite meaning for the ratio.
from tribler.
I think it would make most sense to display just the all-time ratio/numbers but if both are to be shown then separate them like this:
Ratio: 0.1, up: 100 MB, down: 1 GB (Session Ratio: 0.5, up: 1 MB, down: 2 MB)
from tribler.
For debugging, a breakdown of these numbers:
What is shown:
tribler/src/tribler/gui/widgets/downloadsdetailstabwidget.py
Lines 174 to 178 in 4e25843
Where it comes from:
tribler/src/tribler/core/components/libtorrent/restapi/downloads_endpoint.py
Lines 331 to 333 in b89ca5b
How it's implemented:
The core of the inconsistency seems to be that the shown ratio is all_time_upload / total_done
and the expected ratio (based on the reported "up" and "down") is total_upload / total_download
.
from tribler.
All time ratio is defined as total from, say, 10 Tribler sessions. The original if report was (possibly) simply that all counters reset when restarting Tribler.
from tribler.
Related Issues (20)
- IPv8: OSError: illegal IP address string passed to inet_aton HOT 4
- CoreCrashedError: The Tribler core has unexpectedly finished with exit code 9 and status: 1. HOT 1
- ValueError: list.remove(x): x not in list
- Blockchain Engineering - class of 2024 - Team Democracy-2: Cypto Core HOT 23
- Blockchain Engineering - class of 2024 - Team Democracy-3: self-evolving blockchain HOT 22
- Blockchain Engineering - class of 2024 - Team Democracy-1: blockchain networking (a) HOT 24
- Blockchain Engineering - class of 2024 - Team Democracy-1: blockchain networking (b) HOT 18
- Blockchain Engineering - class of 2024 - Team Democracy-4: networking of crypto core HOT 18
- Outdated documentation: `state.rst`
- Fix MacOS build on main branch HOT 1
- Json error HOT 4
- Failed to install `ipv8-rust-tunnels` HOT 1
- Error when updating Tribler saying it contains virus or potentially unwanted software HOT 3
- [7.13.3][IPv8] AttributeError: 'socket' object has no attribute 'is_closing' (in UDPEndpoint.close) HOT 3
- [7.13.2] PermissionError when unlinking processes.sqlite "The process cannot access the file because it is being used by another process" HOT 2
- Please add docker version HOT 2
- [ERROR rust_endpoint] Could not send packet to <IP>:<PORT>: Operation not permitted (os error 1)
- Installation failure of requirements on Python 3.10
- ValueError in `query_http_uri`: Can redirect only to http or https HOT 2
- [7.13.3] CoreCrashedError on Linux with error code 4: Interrupted system call (Unterbrechung während des Betriebssystemaufrufs) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tribler.