libzypp: zypp/media/detail/DownloadProgressTracker.h Source File

libzypp 17.36.6

DownloadProgressTracker.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_MEDIA_DETAIL_DOWNLOADPROGRESSTRACKER_INCLUDED
10#define ZYPP_MEDIA_DETAIL_DOWNLOADPROGRESSTRACKER_INCLUDED
11
12#include <chrono>
13#include <optional>
14
15namespace zypp::internal {
16
17 struct ProgressTracker {
18
19 using clock = std::chrono::steady_clock;
20
21 std::optional<clock::time_point> _timeStart;
22 std::optional<clock::time_point> _timeLast;
23
24 double _dnlTotal = 0.0;
25 double _dnlLast = 0.0;
26 double _dnlNow = 0.0;
27
28 int _dnlPercent= 0;
29
30 double _drateTotal= 0.0;
31 double _drateLast = 0.0;
32
33 void updateStats( double dltotal = 0.0, double dlnow = 0.0 );
34};
35
36
37}
38
39
40#endif
zypp::internal
Definition DownloadProgressTracker.cc:13
zypp::internal::ProgressTracker
Definition DownloadProgressTracker.h:17
zypp::internal::ProgressTracker::_timeStart
std::optional< clock::time_point > _timeStart
Start total stats.
Definition DownloadProgressTracker.h:21
zypp::internal::ProgressTracker::_dnlTotal
double _dnlTotal
Bytes to download or 0 if unknown.
Definition DownloadProgressTracker.h:24
zypp::internal::ProgressTracker::_drateLast
double _drateLast
Download rate in last period.
Definition DownloadProgressTracker.h:31
zypp::internal::ProgressTracker::_timeLast
std::optional< clock::time_point > _timeLast
Start last period(~1sec)
Definition DownloadProgressTracker.h:22
zypp::internal::ProgressTracker::_drateTotal
double _drateTotal
Download rate so far.
Definition DownloadProgressTracker.h:30
zypp::internal::ProgressTracker::_dnlLast
double _dnlLast
Bytes downloaded at period start.
Definition DownloadProgressTracker.h:25
zypp::internal::ProgressTracker::_dnlNow
double _dnlNow
Bytes downloaded now.
Definition DownloadProgressTracker.h:26
zypp::internal::ProgressTracker::clock
std::chrono::steady_clock clock
Definition DownloadProgressTracker.h:19
zypp::internal::ProgressTracker::_dnlPercent
int _dnlPercent
Percent completed or 0 if _dnlTotal is unknown.
Definition DownloadProgressTracker.h:28
zypp::internal::ProgressTracker::updateStats
void updateStats(double dltotal=0.0, double dlnow=0.0)
Definition DownloadProgressTracker.cc:15