Changeset 1940

Show
Ignore:
Timestamp:
06/12/2007 08:50:32 (13 months ago)
Author:
chris
Message:

Use new logging framework for tracing diffs.

Log each block found and each false match at DEBUG level.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/backupclient/BackupStoreFileDiff.cpp

    r1191 r1940  
    1919#endif 
    2020 
     21#include "BackupStoreConstants.h" 
     22#include "BackupStoreException.h" 
    2123#include "BackupStoreFile.h" 
     24#include "BackupStoreFileCryptVar.h" 
     25#include "BackupStoreFileEncodeStream.h" 
    2226#include "BackupStoreFileWire.h" 
    23 #include "BackupStoreFileCryptVar.h" 
    2427#include "BackupStoreObjectMagic.h" 
    25 #include "BackupStoreException.h" 
    26 #include "BackupStoreFileEncodeStream.h" 
    27 #include "BackupStoreConstants.h" 
     28#include "CommonException.h" 
    2829#include "FileStream.h" 
     30#include "MD5Digest.h" 
    2931#include "RollingChecksum.h" 
    30 #include "MD5Digest.h" 
    31 #include "CommonException.h" 
    3232#include "Timer.h" 
    3333 
     
    486486        } 
    487487         
    488         // TODO: Use buffered file class 
    489         // Because we read in the file a scanned block size at a time, it is likely to be 
    490         // inefficient. Probably will be much better to use a buffering IOStream class which 
    491         // reads data in at the size of the filesystem block size. 
     488        // TODO: Because we read in the file a scanned block size at a time, 
     489        // it is likely to be inefficient. Probably will be much better to 
     490        // calculate checksums for all block sizes in a single pass. 
    492491 
    493492        // Allocate the buffers. 
     
    514513                { 
    515514                        ASSERT(Sizes[s] <= bufSize); 
    516                         //TRACE2("Diff pass %d, for block size %d\n", s, Sizes[s]); 
     515                        BOX_TRACE("Diff pass " << s << ", for block size " << 
     516                                Sizes[s]); 
    517517                         
    518518                        // Check we haven't finished 
     
    553553                                { 
    554554                                        ASSERT(pDiffTimer != NULL); 
    555                                         TRACE0("MaximumDiffingTime reached - " 
    556                                                 "suspending file diff\n"); 
     555                                        BOX_INFO("MaximumDiffingTime reached - " 
     556                                                "suspending file diff"); 
    557557                                        abortSearch = true; 
    558558                                        break; 
     
    622622                                                if(SecondStageMatch(phashTable[hash], rolling, beginnings, endings, offset, Sizes[s], fileBlockNumber, pIndex, rFoundBlocks)) 
    623623                                                { 
     624                                                        BOX_TRACE("Found block match for " << hash << " of " << Sizes[s] << " bytes at offset " << fileOffset); 
    624625                                                        goodnessOfFit[fileOffset] = Sizes[s]; 
    625626 
     
    646647                                                        // End this loop, so the final byte isn't used again 
    647648                                                        break; 
     649                                                } 
     650                                                else 
     651                                                { 
     652                                                        BOX_TRACE("False alarm match for " << hash << " of " << Sizes[s] << " bytes at offset " << fileOffset); 
    648653                                                } 
    649654 
     
    723728        { 
    724729                // Trace out the found blocks in debug mode 
    725                 TRACE0("Diff: list of found blocks\n======== ======== ======== ========\n  Offset   BlkIdx     Size Movement\n"); 
     730                BOX_TRACE("Diff: list of found blocks"); 
     731                BOX_TRACE("======== ======== ======== ========"); 
     732                BOX_TRACE("  Offset   BlkIdx     Size Movement"); 
    726733                for(std::map<int64_t, int64_t>::const_iterator i(rFoundBlocks.begin()); i != rFoundBlocks.end(); ++i) 
    727734                { 
     
    731738                                orgLoc += pIndex[b].mSize; 
    732739                        } 
    733                         TRACE4("%8lld %8lld %8lld %8lld\n", i->first, i->second, 
    734                                 (int64_t)(pIndex[i->second].mSize), i->first - orgLoc); 
    735                 } 
    736                 TRACE0("======== ======== ======== ========\n"); 
     740                        BOX_TRACE(std::setw(8) << i->first << " " << 
     741                                std::setw(8) << i->second << " " << 
     742                                std::setw(8) << pIndex[i->second].mSize <<  
     743                                " " <<  
     744                                std::setw(8) << (i->first - orgLoc)); 
     745                } 
     746                BOX_TRACE("======== ======== ======== ========"); 
    737747        } 
    738748#endif