|
| ProgressDisplay () |
| Constructor. More...
|
|
| ProgressDisplay () |
|
virtual void | BeginJob (uint16_t jobNum, uint16_t jobTotal, const XrdCl::URL *source, const XrdCl::URL *destination) |
| Begin job. More...
|
|
virtual void | EndJob (uint16_t jobNum, const XrdCl::PropertyList *results) |
| End job. More...
|
|
virtual void | EndJob (uint16_t jobNum, const XrdCl::PropertyList *results) |
|
std::string | GetProgressBar (time_t now) |
| Get progress bar. More...
|
|
std::string | GetSummaryBar (time_t now) |
| Get sumary bar. More...
|
|
virtual void | JobProgress (uint16_t jobNum, uint64_t bytesProcessed, uint64_t bytesTotal) |
| Job progress. More...
|
|
virtual void | JobProgress (uint16_t jobNum, uint64_t bytesProcessed, uint64_t bytesTotal) |
|
void | PrintAdditionalCheckSum (bool print) |
|
void | PrintCheckSum (const XrdCl::URL *url, const std::string &checkSum, uint64_t size) |
| Print the checksum. More...
|
|
void | PrintProgressBar (bool print) |
|
void | PrintSourceCheckSum (bool print) |
|
void | PrintTargetCheckSum (bool print) |
|
Public Member Functions inherited from XrdCl::CopyProgressHandler |
virtual | ~CopyProgressHandler () |
|
virtual bool | ShouldCancel (uint16_t jobNum) |
| Determine whether the job should be canceled. More...
|
|
Definition at line 47 of file XrdClCopy.cc.
◆ ProgressDisplay() [1/2]
ProgressDisplay::ProgressDisplay |
( |
| ) |
|
|
inline |
Constructor.
Definition at line 53 of file XrdClCopy.cc.
53 : pPrevious(0), pPrintProgressBar(
true),
54 pPrintSourceCheckSum(
false), pPrintTargetCheckSum(
false),
55 pPrintAdditionalCheckSum(
false)
◆ ProgressDisplay() [2/2]
ProgressDisplay::ProgressDisplay |
( |
| ) |
|
|
inline |
Definition at line 1427 of file XrdClFS.cc.
1427 : pBytesProcessed(0), pBytesTotal(0), pPrevious(0)
◆ BeginJob()
virtual void ProgressDisplay::BeginJob |
( |
uint16_t |
jobNum, |
|
|
uint16_t |
jobTotal, |
|
|
const XrdCl::URL * |
source, |
|
|
const XrdCl::URL * |
destination |
|
) |
| |
|
inlinevirtual |
Begin job.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 61 of file XrdClCopy.cc.
67 if( pPrintProgressBar )
71 std::cerr <<
"Job: " << jobNum <<
"/" << jobTotal << std::endl;
72 std::cerr <<
"Source: " << source->
GetURL() << std::endl;
73 std::cerr <<
"Target: " << destination->
GetURL() << std::endl;
81 d.target = destination;
82 pOngoingJobs[jobNum] = d;
std::string GetURL() const
Get the URL.
References XrdCl::URL::GetURL().
◆ EndJob() [1/2]
End job.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 88 of file XrdClCopy.cc.
92 std::map<uint16_t, JobData>::iterator it = pOngoingJobs.find( jobNum );
93 if( it == pOngoingJobs.end() )
96 JobData &d = it->second;
101 JobProgress( jobNum, d.bytesProcessed, d.bytesTotal );
103 if( pPrintProgressBar )
105 if( pOngoingJobs.size() > 1 )
106 std::cerr <<
"\r" << std::string(70,
' ') <<
"\r";
108 std::cerr << std::endl;
112 results->
Get(
"status", st );
115 pOngoingJobs.erase(it);
119 std::string checkSum;
121 results->
Get(
"size", size );
122 if( pPrintSourceCheckSum )
124 results->
Get(
"sourceCheckSum", checkSum );
128 if( pPrintTargetCheckSum )
130 results->
Get(
"targetCheckSum", checkSum );
134 if( pPrintAdditionalCheckSum )
136 std::vector<std::string> addcksums;
137 results->
Get(
"additionalCkeckSum", addcksums );
138 for(
auto &cks : addcksums )
142 pOngoingJobs.erase(it);
void PrintCheckSum(const XrdCl::URL *url, const std::string &checkSum, uint64_t size)
Print the checksum.
virtual void JobProgress(uint16_t jobNum, uint64_t bytesProcessed, uint64_t bytesTotal)
Job progress.
bool Get(const std::string &name, Item &item) const
bool IsOK() const
We're fine.
References XrdCl::PropertyList::Get(), XrdCl::Status::IsOK(), JobProgress(), and PrintCheckSum().
◆ EndJob() [2/2]
Notify when the previous job has finished
- Parameters
-
jobNum | job number |
result | result of the job |
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 1433 of file XrdClFS.cc.
1435 JobProgress( jobNum, pBytesProcessed, pBytesTotal );
1436 std::cerr << std::endl;
◆ GetProgressBar()
std::string ProgressDisplay::GetProgressBar |
( |
time_t |
now | ) |
|
|
inline |
Get progress bar.
Definition at line 148 of file XrdClCopy.cc.
150 JobData &d = pOngoingJobs.begin()->second;
154 speed = d.bytesProcessed/(now-d.started);
156 speed = d.bytesProcessed;
164 prog = (int)((
double)d.bytesProcessed/d.bytesTotal*50);
165 proc = (int)((
double)d.bytesProcessed/d.bytesTotal*100);
172 bar.append( prog,
'=' );
176 std::ostringstream o;
179 o <<
"[" << std::setw(3) << std::right << proc <<
"%]";
180 o <<
"[" << std::setw(50) << std::left;
static std::string BytesToString(uint64_t bytes)
Convert bytes to a human readable string.
References XrdCl::Utils::BytesToString().
Referenced by JobProgress().
◆ GetSummaryBar()
std::string ProgressDisplay::GetSummaryBar |
( |
time_t |
now | ) |
|
|
inline |
Get sumary bar.
Definition at line 190 of file XrdClCopy.cc.
192 std::map<uint16_t, JobData>::iterator it;
193 std::ostringstream o;
195 for( it = pOngoingJobs.begin(); it != pOngoingJobs.end(); ++it )
197 JobData &d = it->second;
198 uint16_t jobNum = it->first;
202 speed = d.bytesProcessed/(now-d.started);
206 proc = (int)((
double)d.bytesProcessed/d.bytesTotal*100);
210 o <<
"[#" << jobNum <<
": ";
References XrdCl::Utils::BytesToString().
Referenced by JobProgress().
◆ JobProgress() [1/2]
virtual void ProgressDisplay::JobProgress |
( |
uint16_t |
jobNum, |
|
|
uint64_t |
bytesProcessed, |
|
|
uint64_t |
bytesTotal |
|
) |
| |
|
inlinevirtual |
Job progress.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 221 of file XrdClCopy.cc.
227 if( pPrintProgressBar )
229 time_t now = time(0);
230 if( (now - pPrevious < 1) && (bytesProcessed != bytesTotal) )
234 std::map<uint16_t, JobData>::iterator it = pOngoingJobs.find( jobNum );
235 if( it == pOngoingJobs.end() )
238 JobData &d = it->second;
240 d.bytesProcessed = bytesProcessed;
241 d.bytesTotal = bytesTotal;
243 std::string progress;
244 if( pOngoingJobs.size() == 1 )
249 std::cerr <<
"\r" << progress << std::flush;
std::string GetProgressBar(time_t now)
Get progress bar.
std::string GetSummaryBar(time_t now)
Get sumary bar.
References GetProgressBar(), and GetSummaryBar().
Referenced by EndJob().
◆ JobProgress() [2/2]
virtual void ProgressDisplay::JobProgress |
( |
uint16_t |
jobNum, |
|
|
uint64_t |
bytesProcessed, |
|
|
uint64_t |
bytesTotal |
|
) |
| |
|
inlinevirtual |
Notify about the progress of the current job
- Parameters
-
jobNum | job number |
bytesProcessed | bytes processed by the current job |
bytesTotal | total number of bytes to be processed by the current job |
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 1442 of file XrdClFS.cc.
1446 pBytesProcessed = bytesProcessed;
1447 pBytesTotal = bytesTotal;
1449 time_t now = time(0);
1450 if( (now - pPrevious < 1) && (bytesProcessed != bytesTotal) )
1455 std::cerr <<
"Progress: ";
1459 std::cerr <<
"(" << bytesProcessed*100/bytesTotal <<
"%)";
1461 std::cerr << std::flush;
References XrdCl::Utils::BytesToString().
◆ PrintAdditionalCheckSum()
void ProgressDisplay::PrintAdditionalCheckSum |
( |
bool |
print | ) |
|
|
inline |
Definition at line 284 of file XrdClCopy.cc.
284 { pPrintAdditionalCheckSum = print; }
Referenced by main().
◆ PrintCheckSum()
void ProgressDisplay::PrintCheckSum |
( |
const XrdCl::URL * |
url, |
|
|
const std::string & |
checkSum, |
|
|
uint64_t |
size |
|
) |
| |
|
inline |
Print the checksum.
Definition at line 256 of file XrdClCopy.cc.
260 if( checkSum.empty() )
262 std::string::size_type i = checkSum.find(
':' );
263 std::cerr << checkSum.substr( 0, i+1 ) <<
" ";
264 std::cerr << checkSum.substr( i+1, checkSum.length()-i ) <<
" ";
267 std::cerr << url->
GetPath() <<
" ";
271 std::cerr << url->
GetPath() <<
" ";
275 std::cerr << std::endl;
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
const std::string & GetProtocol() const
Get the protocol.
const std::string & GetPath() const
Get the path.
References XrdCl::URL::GetHostId(), XrdCl::URL::GetPath(), XrdCl::URL::GetProtocol(), and XrdCl::URL::IsLocalFile().
Referenced by EndJob().
◆ PrintProgressBar()
void ProgressDisplay::PrintProgressBar |
( |
bool |
print | ) |
|
|
inline |
◆ PrintSourceCheckSum()
void ProgressDisplay::PrintSourceCheckSum |
( |
bool |
print | ) |
|
|
inline |
◆ PrintTargetCheckSum()
void ProgressDisplay::PrintTargetCheckSum |
( |
bool |
print | ) |
|
|
inline |
The documentation for this class was generated from the following files: