|
| | ProgressDisplay () |
| | Constructor. More...
|
| |
| | ProgressDisplay () |
| |
| virtual void | BeginJob (uint32_t jobNum, uint32_t jobTotal, const XrdCl::URL *source, const XrdCl::URL *destination) |
| | Begin job. More...
|
| |
| virtual void | EndJob (uint32_t jobNum, const XrdCl::PropertyList *results) |
| | End job. More...
|
| |
| virtual void | EndJob (uint32_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 (uint32_t jobNum, uint64_t bytesProcessed, uint64_t bytesTotal) |
| | Job progress. More...
|
| |
| virtual void | JobProgress (uint32_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 (uint32_t jobNum) |
| | Determine whether the job should be canceled. More...
|
| |
Definition at line 50 of file XrdClCopy.cc.
◆ ProgressDisplay() [1/2]
| ProgressDisplay::ProgressDisplay |
( |
| ) |
|
|
inline |
Constructor.
Definition at line 56 of file XrdClCopy.cc.
56 : pPrevious(0), pPrintProgressBar(
true),
57 pPrintSourceCheckSum(
false), pPrintTargetCheckSum(
false),
58 pPrintAdditionalCheckSum(
false)
◆ ProgressDisplay() [2/2]
| ProgressDisplay::ProgressDisplay |
( |
| ) |
|
|
inline |
Definition at line 1558 of file XrdClFS.cc.
1558 : pBytesProcessed(0), pBytesTotal(0), pPrevious(0)
◆ BeginJob()
| virtual void ProgressDisplay::BeginJob |
( |
uint32_t |
jobNum, |
|
|
uint32_t |
jobTotal, |
|
|
const XrdCl::URL * |
source, |
|
|
const XrdCl::URL * |
destination |
|
) |
| |
|
inlinevirtual |
Begin job.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 64 of file XrdClCopy.cc.
70 if( pPrintProgressBar )
74 std::cerr <<
"Job: " << jobNum <<
"/" << jobTotal << std::endl;
75 std::cerr <<
"Source: " << source->
GetURL() << std::endl;
76 std::cerr <<
"Target: " << destination->
GetURL() << std::endl;
84 d.target = destination;
85 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 91 of file XrdClCopy.cc.
95 std::map<uint32_t, JobData>::iterator it = pOngoingJobs.find( jobNum );
96 if( it == pOngoingJobs.end() )
99 JobData &d = it->second;
104 JobProgress( jobNum, d.bytesProcessed, d.bytesTotal );
106 if( pPrintProgressBar )
108 if( pOngoingJobs.size() > 1 )
109 std::cerr <<
"\r" << std::string(70,
' ') <<
"\r";
111 std::cerr << std::endl;
115 results->
Get(
"status", st );
118 pOngoingJobs.erase(it);
122 std::string checkSum;
124 results->
Get(
"size", size );
125 if( pPrintSourceCheckSum )
127 results->
Get(
"sourceCheckSum", checkSum );
131 if( pPrintTargetCheckSum )
133 results->
Get(
"targetCheckSum", checkSum );
137 if( pPrintAdditionalCheckSum )
139 std::vector<std::string> addcksums;
140 results->
Get(
"additionalCkeckSum", addcksums );
141 for(
auto &cks : addcksums )
145 pOngoingJobs.erase(it);
void PrintCheckSum(const XrdCl::URL *url, const std::string &checkSum, uint64_t size)
Print the checksum.
virtual void JobProgress(uint32_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(), and XrdCl::Status::IsOK().
◆ 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 1564 of file XrdClFS.cc.
1566 JobProgress( jobNum, pBytesProcessed, pBytesTotal );
1567 std::cerr << std::endl;
◆ GetProgressBar()
| std::string ProgressDisplay::GetProgressBar |
( |
time_t |
now | ) |
|
|
inline |
Get progress bar.
Definition at line 151 of file XrdClCopy.cc.
153 JobData &d = pOngoingJobs.begin()->second;
157 speed = d.bytesProcessed/(now-d.started);
159 speed = d.bytesProcessed;
167 prog = (int)((
double)d.bytesProcessed/d.bytesTotal*50);
168 proc = (int)((
double)d.bytesProcessed/d.bytesTotal*100);
175 bar.append( prog,
'=' );
179 std::ostringstream o;
182 o <<
"[" << std::setw(3) << std::right << proc <<
"%]";
183 o <<
"[" << std::setw(50) << std::left;
static std::string BytesToString(uint64_t bytes)
Convert bytes to a human readable string.
References XrdCl::Utils::BytesToString().
◆ GetSummaryBar()
| std::string ProgressDisplay::GetSummaryBar |
( |
time_t |
now | ) |
|
|
inline |
Get sumary bar.
Definition at line 193 of file XrdClCopy.cc.
195 std::map<uint32_t, JobData>::iterator it;
196 std::ostringstream o;
198 for( it = pOngoingJobs.begin(); it != pOngoingJobs.end(); ++it )
200 JobData &d = it->second;
201 uint32_t jobNum = it->first;
205 speed = d.bytesProcessed/(now-d.started);
209 proc = (int)((
double)d.bytesProcessed/d.bytesTotal*100);
213 o <<
"[#" << jobNum <<
": ";
References XrdCl::Utils::BytesToString().
◆ JobProgress() [1/2]
| virtual void ProgressDisplay::JobProgress |
( |
uint32_t |
jobNum, |
|
|
uint64_t |
bytesProcessed, |
|
|
uint64_t |
bytesTotal |
|
) |
| |
|
inlinevirtual |
Job progress.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 224 of file XrdClCopy.cc.
230 if( pPrintProgressBar )
232 time_t now = time(0);
233 if( (now - pPrevious < 1) && (bytesProcessed != bytesTotal) )
237 std::map<uint32_t, JobData>::iterator it = pOngoingJobs.find( jobNum );
238 if( it == pOngoingJobs.end() )
241 JobData &d = it->second;
243 d.bytesProcessed = bytesProcessed;
244 d.bytesTotal = bytesTotal;
246 std::string progress;
247 if( pOngoingJobs.size() == 1 )
252 std::cerr <<
"\r" << progress << std::flush;
std::string GetProgressBar(time_t now)
Get progress bar.
std::string GetSummaryBar(time_t now)
Get sumary bar.
◆ JobProgress() [2/2]
| virtual void ProgressDisplay::JobProgress |
( |
uint32_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 1573 of file XrdClFS.cc.
1577 pBytesProcessed = bytesProcessed;
1578 pBytesTotal = bytesTotal;
1580 time_t now = time(0);
1581 if( (now - pPrevious < 1) && (bytesProcessed != bytesTotal) )
1586 std::cerr <<
"Progress: ";
1590 std::cerr <<
"(" << bytesProcessed*100/bytesTotal <<
"%)";
1592 std::cerr << std::flush;
References XrdCl::Utils::BytesToString().
◆ PrintAdditionalCheckSum()
| void ProgressDisplay::PrintAdditionalCheckSum |
( |
bool |
print | ) |
|
|
inline |
Definition at line 287 of file XrdClCopy.cc.
287 { 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 259 of file XrdClCopy.cc.
263 if( checkSum.empty() )
265 std::string::size_type i = checkSum.find(
':' );
266 std::cerr << checkSum.substr( 0, i+1 ) <<
" ";
267 std::cerr << checkSum.substr( i+1, checkSum.length()-i ) <<
" ";
270 std::cerr << url->
GetPath() <<
" ";
274 std::cerr << url->
GetPath() <<
" ";
278 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().
◆ 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: