From 79e0bbb3d773037371ff83563aba8ebdb20190e8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 17 Nov 2010 09:49:39 +0000 Subject: Log the total number of bytes uploaded to the server for each file. --- lib/backupclient/BackupStoreFile.cpp | 8 +++++--- lib/backupclient/BackupStoreFile.h | 7 +++++-- lib/backupclient/BackupStoreFileEncodeStream.cpp | 2 ++ lib/backupclient/BackupStoreFileEncodeStream.h | 2 ++ 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/backupclient') diff --git a/lib/backupclient/BackupStoreFile.cpp b/lib/backupclient/BackupStoreFile.cpp index 4bd75f96..44d96d0c 100644 --- a/lib/backupclient/BackupStoreFile.cpp +++ b/lib/backupclient/BackupStoreFile.cpp @@ -73,9 +73,11 @@ BackupStoreFileStats BackupStoreFile::msStats = {0,0,0}; // Created: 2003/08/28 // // -------------------------------------------------------------------------- -std::auto_ptr BackupStoreFile::EncodeFile(const char *Filename, - int64_t ContainerID, const BackupStoreFilename &rStoreFilename, - int64_t *pModificationTime, ReadLoggingStream::Logger* pLogger, +std::auto_ptr BackupStoreFile::EncodeFile( + const char *Filename, int64_t ContainerID, + const BackupStoreFilename &rStoreFilename, + int64_t *pModificationTime, + ReadLoggingStream::Logger* pLogger, RunStatusProvider* pRunStatusProvider) { // Create the stream diff --git a/lib/backupclient/BackupStoreFile.h b/lib/backupclient/BackupStoreFile.h index f4c60919..f5bc1924 100644 --- a/lib/backupclient/BackupStoreFile.h +++ b/lib/backupclient/BackupStoreFile.h @@ -118,11 +118,14 @@ public: // Main interface - static std::auto_ptr EncodeFile(const char *Filename, + static std::auto_ptr EncodeFile + ( + const char *Filename, int64_t ContainerID, const BackupStoreFilename &rStoreFilename, int64_t *pModificationTime = 0, ReadLoggingStream::Logger* pLogger = NULL, - RunStatusProvider* pRunStatusProvider = NULL); + RunStatusProvider* pRunStatusProvider = NULL + ); static std::auto_ptr EncodeFileDiff ( const char *Filename, int64_t ContainerID, diff --git a/lib/backupclient/BackupStoreFileEncodeStream.cpp b/lib/backupclient/BackupStoreFileEncodeStream.cpp index 54c2463d..e9d773f0 100644 --- a/lib/backupclient/BackupStoreFileEncodeStream.cpp +++ b/lib/backupclient/BackupStoreFileEncodeStream.cpp @@ -55,6 +55,7 @@ BackupStoreFileEncodeStream::BackupStoreFileEncodeStream() mPositionInCurrentBlock(0), mBlockSize(BACKUP_FILE_MIN_BLOCK_SIZE), mLastBlockSize(0), + mTotalBytesSent(0), mpRawBuffer(0), mAllocatedBufferSize(0), mEntryIVBase(0) @@ -463,6 +464,7 @@ int BackupStoreFileEncodeStream::Read(void *pBuffer, int NBytes, int Timeout) // Add encoded size to stats BackupStoreFile::msStats.mTotalFileStreamSize += (NBytes - bytesToRead); + mTotalBytesSent += (NBytes - bytesToRead); // Return size of data to caller return NBytes - bytesToRead; diff --git a/lib/backupclient/BackupStoreFileEncodeStream.h b/lib/backupclient/BackupStoreFileEncodeStream.h index c5fa780a..023994af 100644 --- a/lib/backupclient/BackupStoreFileEncodeStream.h +++ b/lib/backupclient/BackupStoreFileEncodeStream.h @@ -85,6 +85,7 @@ public: virtual void Write(const void *pBuffer, int NBytes); virtual bool StreamDataLeft(); virtual bool StreamClosed(); + int64_t GetTotalBytesSent() { return mTotalBytesSent; } private: enum @@ -121,6 +122,7 @@ private: int32_t mPositionInCurrentBlock; // for reading out int32_t mBlockSize; // Basic block size of most of the blocks in the file int32_t mLastBlockSize; // the size (unencoded) of the last block in the file + int64_t mTotalBytesSent; // Buffers uint8_t *mpRawBuffer; // buffer for raw data BackupStoreFile::EncodingBuffer mEncodedBuffer; -- cgit v1.2.3