Changeset 1729


Ignore:
Timestamp:
Jul 6, 2010, 9:56:47 AM (11 years ago)
Author:
Paul Lelgemann
Message:

o KeySearcher: fixed bugs in global statistic

Location:
trunk/CrypPlugins/KeySearcher/P2P
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/P2P/DistributedBruteForceManager.cs

    r1727 r1729  
    7575
    7676            status.StartDate = keyPoolTree.StartDate();
     77            keyPoolTree.UpdateStatusForNewCalculation();
    7778
    7879            Leaf currentLeaf;
  • trunk/CrypPlugins/KeySearcher/P2P/Presentation/StatisticsGenerator.cs

    r1727 r1729  
    140140        }
    141141
    142         public void CalculateGlobalStatistics(BigInteger nextChunk)
    143         {
    144             if (HighestChunkCalculated == -1) HighestChunkCalculated = nextChunk;
    145             if (nextChunk <= HighestChunkCalculated) return;
    146 
    147             var totalAmountOfParticipants = nextChunk - HighestChunkCalculated;
     142        public void CalculateGlobalStatistics(BigInteger currentChunkCalculated)
     143        {
     144            if (HighestChunkCalculated == -1) HighestChunkCalculated = currentChunkCalculated;
     145            if (currentChunkCalculated < HighestChunkCalculated) return;
     146
     147            var totalAmountOfParticipants = currentChunkCalculated - HighestChunkCalculated;
    148148            status.TotalAmountOfParticipants = totalAmountOfParticipants;
    149149
    150150            var timeUsedForLatestProgress = DateTime.Now.Subtract(lastDateOfGlobalStatistics);
    151151            var secondsForOneChunk = timeUsedForLatestProgress.TotalSeconds/(double) totalAmountOfParticipants;
    152             var remainingChunks = TotalAmountOfChunks - nextChunk;
     152            var remainingChunks = TotalAmountOfChunks - currentChunkCalculated;
    153153            var secondsRemaining = (double) remainingChunks*secondsForOneChunk;
    154154
     
    168168            lastDateOfGlobalStatistics = DateTime.Now;
    169169
    170             HighestChunkCalculated = nextChunk;
     170            HighestChunkCalculated = currentChunkCalculated;
    171171            status.GlobalProgress = (double) HighestChunkCalculated/(double) TotalAmountOfChunks;
    172172            keySearcher.ProgressChanged(status.GlobalProgress, 1);
  • trunk/CrypPlugins/KeySearcher/P2P/Tree/KeyPoolTree.cs

    r1727 r1729  
    3535            storageHelper = new StorageHelper(keySearcher, statisticsGenerator, statusContainer);
    3636            statusUpdater = new StatusUpdater(statusContainer, identifierGenerator.GenerateStatusKey());
    37             UpdateStatusForNewCalculation();
    3837            skippedReservedNodes = false;
    3938            updateIntervalMod = 5;
     
    135134        }
    136135
    137         private void UpdateStatusForNewCalculation()
     136        public void UpdateStatusForNewCalculation()
    138137        {
    139138            statusUpdater.SendUpdate(DistributedJobStatus.Status.New);
Note: See TracChangeset for help on using the changeset viewer.