Ignore:
Timestamp:
Jan 30, 2011, 5:29:42 PM (11 years ago)
Author:
nolte
Message:

Added more Information to the Information-Tag of the
StatisticPresentation.

File:
1 edited

Legend:

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

    r2524 r2527  
    293293            p2PQuickWatchPresentation = ((QuickWatch)QuickWatchPresentation).P2PQuickWatchPresentation;
    294294            p2PQuickWatchPresentation.UpdateSettings(this, settings);
    295             ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.UpdateInformation(this,settings);
    296295
    297296            settings.PropertyChanged += SettingsPropertyChanged;
     
    312311            ((QuickWatch)QuickWatchPresentation).IsOpenCLEnabled = (settings.DeviceSettings.Count(x => x.useDevice) > 0);
    313312            p2PQuickWatchPresentation.UpdateSettings(this, settings);
    314             ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.UpdateInformation(this, settings);
    315313        }
    316314
     
    13141312        }
    13151313
     1314        private DateTime startDate;
     1315        public void SetBeginningDate(DateTime sd)
     1316        {
     1317            startDate = sd;
     1318        }
     1319
    13161320        public void ResetStatistics()
    13171321        {
     
    13201324            maschinehierarchie = null;
    13211325            maschinehierarchie = new Dictionary<long, Maschinfo>();
     1326        }
     1327
     1328        public void InitialiseInformationQuickwatch()
     1329        {
     1330            if (Pattern == null || !Pattern.testWildcardKey(settings.Key) || settings.ChunkSize == 0)
     1331            {
     1332                return;
     1333            }
     1334
     1335            var keyPattern = Pattern;
     1336            var keysPerChunk = Math.Pow(2, settings.ChunkSize);
     1337            var keyPatternPool = new KeyPatternPool(keyPattern, new BigInteger(keysPerChunk));
     1338
     1339            ((QuickWatch) QuickWatchPresentation).StatisticsPresentation.TotalBlocks = keyPatternPool.Length;
     1340            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.TotalKeys = new BigInteger(keysPerChunk) * keyPatternPool.Length;   
     1341            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.Days = DateTime.UtcNow.Subtract(startDate).Days + " Days";
     1342            UpdateStatisticsPresentation();
    13221343        }
    13231344
     
    13711392            }
    13721393            GenerateMaschineStats();
    1373 
    13741394            //The following Method can be used to write a local csv file with the User/Maschine Statistics.
    13751395            //WriteStatistics(dataIdentifier);
     1396            UpdateStatisticsPresentation();
    13761397           
     1398            updateToplist();
     1399        }
     1400
     1401        //Update the Statistic Presentation
     1402        internal void UpdateStatisticsPresentation()
     1403        {
     1404            var calcChunks = calculatedChunks();
    13771405            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.Statistics = statistic;
    13781406            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.MachineHierarchy = maschinehierarchie;
    1379 
    1380             updateToplist();
     1407            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.Days = DateTime.UtcNow.Subtract(startDate).Days + " Days";
     1408            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.CalculatedBlocks = calcChunks;
     1409            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.CalculatedKeys = calcChunks * (BigInteger)Math.Pow(2, settings.ChunkSize);
     1410            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.Percent = (double)calcChunks;
     1411            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.Users = statistic.Keys.Count;
     1412            ((QuickWatch)QuickWatchPresentation).StatisticsPresentation.Machines = maschinehierarchie.Keys.Count;
    13811413        }
    13821414
     
    14631495
    14641496            maschinehierarchie = maschinehierarchie.OrderByDescending((x) => x.Value.Sum).ToDictionary(x => x.Key, y => y.Value);
     1497        }
     1498
     1499        internal BigInteger calculatedChunks()
     1500        {
     1501            return maschinehierarchie.Keys.Aggregate<long, BigInteger>(0, (current, mid) => current + maschinehierarchie[mid].Sum);
    14651502        }
    14661503
Note: See TracChangeset for help on using the changeset viewer.