File transfer statistics. More...
#include <FCTransferStats.hpp>
Public Types | |
enum | EState { kInvalid = -1, kUnknown = 0, kMd5InProgress = 10, kMd5Success, kMd5Failed, kMd5Skipped, kPending = 20, kTransferStarted, kTransferFinished, kTransferFailed, kFull = 30, kPartial, kSkippedMD5, kSkippedFileExists } |
Used in several locations to indicate the state of the file transfer. More... | |
Public Member Functions | |
TransferStats () | |
Constructor. More... | |
TransferStats & | clear (const bool all=true) |
Clear most or all of the transfer statistics. More... | |
TransferStats & | operator+= (const TransferStats &rhs) |
Combine transfer statistics to get statistics over several files. More... | |
fc::StrMap | getMap (const std::string &header="") const |
Format all the transfer statistics as easy-to-read text strings, and store into a map of strings. More... | |
std::string | getStr (const std::string &header="", const bool all=false) const |
Similar to getMap(), but append all items to create a single multi-line text string to display for debug purposes. More... | |
fc::StrMap & | add_to_map (fc::StrMap &m, const std::string &header="") const |
Get the map entries – similar to getmap() – but instead of returning a new map, add the entries to a pre-existing map. More... | |
fc::Local | target_local_filename () const |
Returns the local filename which should be used. More... | |
fc::Remote | target_remote_filename () const |
Returns the remote filename which should be used. More... | |
bool | tmp_filename_is_disabled () const |
Determine if this file stats object has the necessary filename information to use a temporary filename during transfer. More... | |
bool | tmp_filename_is_enabled () const |
Determine if this file stats object has the necessary filename information to use a temporary filename during transfer. More... | |
Public Attributes | |
EState | md5 |
State of the MD5 verification. More... | |
EState | transfer |
State of the file transfer. More... | |
EState | type |
The type of transfer. More... | |
fc::Local | localFilename |
Including the path. More... | |
fc::Remote | remoteFilename |
Including the path. More... | |
std::chrono::high_resolution_clock::time_point | timeTransferBegan |
The time when the file transfer began. More... | |
std::chrono::high_resolution_clock::time_point | timePreviousBlockFinished |
The time when the last block completed. More... | |
std::chrono::high_resolution_clock::duration | timeRemaining |
The amount of time left at the current transfer rate. More... | |
std::chrono::high_resolution_clock::time_point | timeTransferFinished |
The time when the transfer completed. More... | |
uint64_t | payloadBytesTransferred |
The number of payload bytes. More... | |
uint64_t | payloadBytesExpected |
The total size of the file being transferred. More... | |
uint64_t | payloadBytesSkipped |
The number of bytes that were skipped due to a successful auto-resume of a partial transfer. More... | |
uint64_t | bitsPerSecondAverageTransferRate |
Transfer rates measured in bits per second. More... | |
uint64_t | bitsPerSecondImmediateTransferRate |
Transfer rates measured in bits per second. More... | |
uint64_t | blocksCompleted |
The number of completed transfer blocks. More... | |
uint64_t | blocksRemaining |
The number of transfer blocks remaining. More... | |
uint64_t | packetsReceived |
The total number of packets received from the server. More... | |
uint64_t | packetsSent |
The total number of packets sent to the server (client-side overhead). More... | |
uint64_t | duplicatePacketDropped |
The total number of payload packets dropped because we received a duplicate from the server. More... | |
uint64_t | requestRetransmit |
The total number of client-side requests made to the server to transmit or retransmit a specific packet. More... | |
uint64_t | ackPacketsReceived |
The total number of ack packets. More... | |
uint64_t | dataPacketsReceived |
The total number of data packets received. More... | |
uint64_t | echoPacketsReceived |
The total number of echo packets received. More... | |
uint64_t | metricsPacketsReceived |
The total number of metric packets received. More... | |
uint64_t | metricsPacketsSent |
The total number of metric packets sent. More... | |
uint64_t | packetLossEvent |
The total number of data packet loss events. More... | |
uint64_t | unitSize |
The unit (packet) size. More... | |
uint64_t | blockSize |
The block size. More... | |
bool | encrypted |
Whether the transfer was encrypted using TCP+SSL or UDP+AES. More... | |
bool | upload |
Whether the transfer was an upload or a download. More... | |
uint64_t | onTheFlyMd5Received |
On-the-fly MD5 is not supported by FC++, but the packets are counted. More... | |
uint64_t | fileReaderStarved |
Number of times when the file reader couldn't proceed with reading the file from disk due to insufficient number of memory buffers. More... | |
uint64_t | networkWriterStarved |
Number of times when the network buffer writer couldn't proceed with writing to the socket due to a lack of buffers in the ready-to-write state. More... | |
uint64_t | encryptionThreadStarved |
Number of times when one of the encryption threads had no buffers remaining to encrypt. More... | |
uint64_t | multipleBlocksInAckNackState |
Number of times when there was multiple blocks simultaneously waiting for ACK/NACK acknowledgment. More... | |
std::string | localMd5 |
May not be set if MD5 is disabled. More... | |
std::string | remoteMd5 |
May not be set if MD5 is disabled. More... | |
fc::Local | temporaryLocalFilename |
Temporary filename used during transfer. More... | |
fc::Remote | temporaryRemoteFilename |
Temporary remote filename prior to being renamed. More... | |
File transfer statistics.
Also see fc::GlobalStateAndStats which contains a std::map of TransferStats.
While this class initially contained a few simple statistics (thus the name) it has evolved to function as a transfer record, containing everything needed for the FC object to manage multiple sequential file transfers through the use of the std::map known as TransferStatsMap.
Used in several locations to indicate the state of the file transfer.
Enumerator | |
---|---|
kInvalid | |
kUnknown | |
kMd5InProgress | TransferStats::md5 MD5 verification has started; see fc::Options::setMd5Verification() |
kMd5Success | TransferStats::md5 MD5 verification was successful |
kMd5Failed | TransferStats::md5 MD5 verification failed |
kMd5Skipped | TransferStats::md5 file transfer was skipped since MD5 checksum indicates no changes; see fc::Options::setTransferResume() |
kPending | TransferStats::transfer file is scheduled for transfer, but transfer has not yet started; see fc::Control::prepareSingleFile() or fc::Control::prepareRecursiveDir() |
kTransferStarted | TransferStats::transfer file transfer is in progress |
kTransferFinished | TransferStats::transfer indicates the transfer was successful |
kTransferFailed | TransferStats::transfer transfer did not complete |
kFull | TransferStats::type full transfer (entire file was sent or received) |
kPartial | TransferStats::type only part of the file needed to be transferred (transfer was resumed); see fc::Options::setTransferResume() |
kSkippedMD5 | TransferStats::type the entire file was skipped (md5 matched); see fc::Options::setTransferResume() |
kSkippedFileExists | TransferStats::type the entire file was skipped (overwrite mode is disabled); see fc::Options::setOverwrite() |
fc::TransferStats::TransferStats | ( | ) |
fc::TransferStats & fc::TransferStats::clear | ( | const bool | all = true | ) |
Clear most or all of the transfer statistics.
[in] | all | When set to false the values localFilename , remoteFilename , temporaryLocalFilename , temporaryRemoteFilename , and payloadBytesExpected are preserved (not cleared). |
References kUnknown.
fc::TransferStats & fc::TransferStats::operator+= | ( | const TransferStats & | rhs | ) |
Combine transfer statistics to get statistics over several files.
References ackPacketsReceived, blocksCompleted, blocksRemaining, dataPacketsReceived, duplicatePacketDropped, echoPacketsReceived, encrypted, encryptionThreadStarved, fileReaderStarved, kUnknown, metricsPacketsReceived, metricsPacketsSent, multipleBlocksInAckNackState, networkWriterStarved, onTheFlyMd5Received, packetLossEvent, packetsReceived, packetsSent, payloadBytesExpected, payloadBytesSkipped, payloadBytesTransferred, requestRetransmit, timePreviousBlockFinished, timeRemaining, timeTransferBegan, timeTransferFinished, and upload.
fc::StrMap fc::TransferStats::getMap | ( | const std::string & | header = "" | ) | const |
Format all the transfer statistics as easy-to-read text strings, and store into a map of strings.
[in] | header | Text string to include before every line. |
References fc::formatBytesIEC(), fc::formatTimeDuration(), fc::formatTimeRecent(), fc::formatTransferRate(), and fc::formatTransferStatsEState().
std::string fc::TransferStats::getStr | ( | const std::string & | header = "" , |
const bool | all = false |
||
) | const |
Similar to getMap(), but append all items to create a single multi-line text string to display for debug purposes.
[in] | header | Text string to include before every line. |
[in] | all | Determines whether statistics with zero values are included. |
For example:
...might result in output that looks like this:
fc::StrMap & fc::TransferStats::add_to_map | ( | fc::StrMap & | m, |
const std::string & | header = "" |
||
) | const |
Get the map entries – similar to getmap() – but instead of returning a new map, add the entries to a pre-existing map.
|
inline |
Returns the local filename which should be used.
Normally, this is the same as the "normal" local filename. But when temporary transfer filename support is enabled, this will be different during downloads. Once the transfer has finished, the file is automatically renamed by FC++ from the temporary name to the expected name.
References fc::Name::empty(), localFilename, temporaryLocalFilename, and upload.
|
inline |
Returns the remote filename which should be used.
Normally, this is the same as the "normal" remote filename. But when temporary transfer filename support is enabled, this will be different during uploads. Once the transfer has finished, the file is automatically renamed by FC++ from the temporary name to the expected name.
References fc::Name::empty(), remoteFilename, temporaryRemoteFilename, and upload.
|
inline |
Determine if this file stats object has the necessary filename information to use a temporary filename during transfer.
References fc::Name::empty(), temporaryLocalFilename, temporaryRemoteFilename, and upload.
|
inline |
Determine if this file stats object has the necessary filename information to use a temporary filename during transfer.
References tmp_filename_is_disabled().
EState fc::TransferStats::md5 |
State of the MD5 verification.
For example, see fc::TransferStats::kMd5InProgress.
EState fc::TransferStats::transfer |
State of the file transfer.
For example, see fc::TransferStats::kTransferStarted.
EState fc::TransferStats::type |
The type of transfer.
For example, see fc::TransferStats::kSkippedFileExists.
std::string fc::TransferStats::localMd5 |
May not be set if MD5 is disabled.
std::string fc::TransferStats::remoteMd5 |
May not be set if MD5 is disabled.
fc::Local fc::TransferStats::localFilename |
Including the path.
fc::Remote fc::TransferStats::remoteFilename |
Including the path.
fc::Local fc::TransferStats::temporaryLocalFilename |
Temporary filename used during transfer.
fc::Remote fc::TransferStats::temporaryRemoteFilename |
Temporary remote filename prior to being renamed.
std::chrono::high_resolution_clock::time_point fc::TransferStats::timeTransferBegan |
The time when the file transfer began.
Available when using:
std::chrono::high_resolution_clock::time_point fc::TransferStats::timePreviousBlockFinished |
The time when the last block completed.
Available when using:
std::chrono::high_resolution_clock::duration fc::TransferStats::timeRemaining |
The amount of time left at the current transfer rate.
Available when using:
std::chrono::high_resolution_clock::time_point fc::TransferStats::timeTransferFinished |
The time when the transfer completed.
Available when using:
uint64_t fc::TransferStats::payloadBytesTransferred |
The number of payload bytes.
This is initially set to zero (for new files) and is incremented during an active file transfer.
payloadBytesSkipped
will indicate 1 MiB, payloadBytesTransferred
will start at 1 MiB, and will be incremented to 4 MiB during the file transfer.uint64_t fc::TransferStats::payloadBytesExpected |
The total size of the file being transferred.
This is set by FC++ prior to the transfer starting, and must never be changed.
Available when using:
uint64_t fc::TransferStats::payloadBytesSkipped |
The number of bytes that were skipped due to a successful auto-resume of a partial transfer.
Available when using:
uint64_t fc::TransferStats::bitsPerSecondAverageTransferRate |
Transfer rates measured in bits per second.
This is the data rate at L7, and it does not reflect additional overhead from IP, TCP, UDP, or FileCatalyst headers.
Available when using:
uint64_t fc::TransferStats::bitsPerSecondImmediateTransferRate |
Transfer rates measured in bits per second.
This is the data rate at L7, and it does not reflect additional overhead from IP, TCP, UDP, or FileCatalyst headers.
Available when using:
uint64_t fc::TransferStats::blocksCompleted |
The number of completed transfer blocks.
Available when using:
uint64_t fc::TransferStats::blocksRemaining |
The number of transfer blocks remaining.
Available when using:
uint64_t fc::TransferStats::packetsReceived |
The total number of packets received from the server.
This includes both duplicates and overhead non-data packets. Available when using:
uint64_t fc::TransferStats::packetsSent |
The total number of packets sent to the server (client-side overhead).
Available when using:
uint64_t fc::TransferStats::duplicatePacketDropped |
The total number of payload packets dropped because we received a duplicate from the server.
Available when using:
uint64_t fc::TransferStats::requestRetransmit |
The total number of client-side requests made to the server to transmit or retransmit a specific packet.
Available when using:
uint64_t fc::TransferStats::ackPacketsReceived |
The total number of ack packets.
Available when using:
uint64_t fc::TransferStats::dataPacketsReceived |
The total number of data packets received.
Available when using:
uint64_t fc::TransferStats::echoPacketsReceived |
The total number of echo packets received.
Available when using:
uint64_t fc::TransferStats::metricsPacketsReceived |
The total number of metric packets received.
Available when using:
uint64_t fc::TransferStats::metricsPacketsSent |
The total number of metric packets sent.
Available when using:
uint64_t fc::TransferStats::packetLossEvent |
The total number of data packet loss events.
Available when using:
uint64_t fc::TransferStats::unitSize |
The unit (packet) size.
Available when using:
uint64_t fc::TransferStats::blockSize |
The block size.
Available when using:
bool fc::TransferStats::encrypted |
Whether the transfer was encrypted using TCP+SSL or UDP+AES.
Available when using:
bool fc::TransferStats::upload |
Whether the transfer was an upload or a download.
This is set to TRUE
if uploaded, and FALSE
if downloaded. Available when using:
uint64_t fc::TransferStats::onTheFlyMd5Received |
On-the-fly MD5 is not supported by FC++, but the packets are counted.
uint64_t fc::TransferStats::fileReaderStarved |
Number of times when the file reader couldn't proceed with reading the file from disk due to insufficient number of memory buffers.
Available when using:
uint64_t fc::TransferStats::networkWriterStarved |
Number of times when the network buffer writer couldn't proceed with writing to the socket due to a lack of buffers in the ready-to-write state.
Available when using:
uint64_t fc::TransferStats::encryptionThreadStarved |
Number of times when one of the encryption threads had no buffers remaining to encrypt.
This is normal, since the encryption threads will be in an idle state once the entire file has been fully encrypted. Available when using:
uint64_t fc::TransferStats::multipleBlocksInAckNackState |
Number of times when there was multiple blocks simultaneously waiting for ACK/NACK acknowledgment.
Available when using: