Changeset 1704


Ignore:
Timestamp:
Jun 26, 2010, 11:39:44 AM (11 years ago)
Author:
Paul Lelgemann
Message:

+ KeySearcher: display of aggregated linkmanager statistics
o KeySearcher: job identifier extended with sample decryption data to preserve decryption algorithm settings

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/Internal/P2PBase.cs

    r1702 r1704  
    1717
    1818using System;
     19using System.Linq;
    1920using System.Text;
    2021using System.Threading;
     
    479480        #endregion
    480481
     482        #region Statistic Methods
     483
     484        public long TotalBytesSentOnAllLinks()
     485        {
     486            return (long) linkmanager.GetAllLinkInformation().Sum(linkInformation => linkInformation.TotalBytesSent);
     487        }
     488
     489        public long TotalBytesReceivedOnAllLinks()
     490        {
     491            return (long) linkmanager.GetAllLinkInformation().Sum(linkInformation => linkInformation.TotalBytesReceived);
     492        }
     493
     494        #endregion
     495
    481496        #region Log facility
    482497
  • trunk/CrypPlugins/KeySearcher/KeySearcher.csproj

    r1682 r1704  
    103103  </ItemGroup>
    104104  <ItemGroup>
     105    <Compile Include="Converter\LongToSizeMetricString.cs" />
    105106    <Compile Include="Converter\TimeSpanToRoundedStringConverter.cs" />
    106107    <Compile Include="Converter\TrueToVisibleOrCollapsedConverter.cs" />
  • trunk/CrypPlugins/KeySearcher/P2P/Presentation/StatisticsGenerator.cs

    r1693 r1704  
    66using System.Threading;
    77using System.Windows.Threading;
     8using Cryptool.P2P;
    89using KeySearcher.KeyPattern;
    910using KeySearcherPresentation.Controls;
     
    4748        void StatusPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    4849        {
    49             if (e.PropertyName != "DhtOverheadInReadableTime") return;
    50 
     50            switch (e.PropertyName)
     51            {
     52                case "DhtOverheadInReadableTime":
     53                    HandleUpdateOfOverheadTime();
     54                    break;
     55                case "StoredBytes":
     56                    status.SentBytesByLinkManager = P2PManager.P2PBase.TotalBytesSentOnAllLinks();
     57                    break;
     58                case "RetrievedBytes":
     59                    status.ReceivedBytesByLinkManager = P2PManager.P2PBase.TotalBytesReceivedOnAllLinks();
     60                    break;
     61            }
     62        }
     63
     64        private void HandleUpdateOfOverheadTime()
     65        {
    5166            if (distributedBruteForceManager.StopWatch.Elapsed.Ticks == 0)
    5267            {
     
    5570            }
    5671
    57             var overheadInTicks = (double) status.DhtOverheadInReadableTime.Ticks/
     72            var overheadInTicks = (double)status.DhtOverheadInReadableTime.Ticks /
    5873                           distributedBruteForceManager.StopWatch.Elapsed.Ticks;
    5974            var overheadInPercent = Math.Round(overheadInTicks, 2);
  • trunk/CrypPlugins/KeySearcher/P2P/Presentation/StatusContainer.cs

    r1703 r1704  
    217217        }
    218218
     219        private long sentBytesByLinkManager;
     220        public long SentBytesByLinkManager
     221        {
     222            get { return sentBytesByLinkManager; }
     223            set
     224            {
     225                sentBytesByLinkManager = value;
     226                OnPropertyChanged("SentBytesByLinkManager");
     227            }
     228        }
     229
     230        private long receivedBytesByLinkManager;
     231        public long ReceivedBytesByLinkManager
     232        {
     233            get { return receivedBytesByLinkManager; }
     234            set
     235            {
     236                receivedBytesByLinkManager = value;
     237                OnPropertyChanged("ReceivedBytesByLinkManager");
     238            }
     239        }
     240
    219241        #region INotifyPropertyChanged Members
    220242
  • trunk/CrypPlugins/KeySearcher/P2P/Storage/StorageKeyGenerator.cs

    r1698 r1704  
    1818        public String Generate()
    1919        {
     20            // Add simple data
    2021            var bytesToUse = keySearcher.CostMaster.getBytesToUse();
    2122            var rawIdentifier = "P2PJOB";
     
    2627            rawIdentifier += keySearcher.CostMaster.getRelationOperator();
    2728
     29            // Add initialization vector when available
    2830            if (keySearcher.InitVector != null)
    2931            {
     
    3133            }
    3234
    33             var inputData = Encoding.ASCII.GetString(keySearcher.EncryptedData);
     35            // Add input data with the amount of used bytes
     36            var inputData = keySearcher.EncryptedData;
    3437            if (inputData.Length > bytesToUse)
    35             {
    36                 inputData = inputData.Substring(0, bytesToUse);
    37             }
     38                Array.Copy(inputData, inputData, bytesToUse);
    3839
    39             rawIdentifier += inputData;
     40            rawIdentifier += Encoding.ASCII.GetString(inputData);
     41
     42            // Add cost of input data to preserve cost master settings
     43            rawIdentifier += keySearcher.CostMaster.calculateCost(inputData);
     44
     45            // Add decrypted input data to preserve encryption settings
     46            var keyLength = keySearcher.Pattern.giveInputPattern().Length / 3;
     47            var decryptedData = keySearcher.ControlMaster.Decrypt(inputData, new byte[keyLength], new byte[8]);
     48            rawIdentifier += Encoding.ASCII.GetString(decryptedData);
    4049
    4150            var hashAlgorithm = new SHA1CryptoServiceProvider();
  • trunk/CrypPlugins/KeySearcher/Presentation/Controls/P2PQuickWatchPresentation.xaml

    r1701 r1704  
    33                <Converter:TrueToVisibleOrCollapsedConverter x:Key="TrueToVisibleOrCollapsedConverter" />
    44        <Converter:TimeSpanToRoundedStringConverter x:Key="TimeSpanToRoundedStringConverter" />
     5        <Converter:LongToSizeMetricString x:Key="LongToSizeMetricString" />
    56        </UserControl.Resources>
    67        <Viewbox>
     
    5960                                </Border>
    6061                                <Border BorderBrush="Silver" BorderThickness="0,0,0,2" Visibility="{Binding IsVerboseEnabled, ElementName=P2PQuickWatch, Converter={StaticResource TrueToVisibleOrCollapsedConverter}}">
    61                                         <Grid Height="136">
     62                                        <Grid Height="204">
    6263                                                <Grid.ColumnDefinitions>
    6364                                                        <ColumnDefinition Width="190" />
     
    6970                                                        <RowDefinition Height="34" />
    7071                                                        <RowDefinition Height="34" />
     72                            <RowDefinition Height="34" />
     73                            <RowDefinition Height="34" />
    7174                                                </Grid.RowDefinitions>
    7275                                                <Label Content="Total DHT requests:" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="0" />
     
    8083                                                <Label Content="Store requests:" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Row="2" />
    8184                                                <Label Content="{Binding StoreRequests, FallbackValue=-}" Height="28" HorizontalAlignment="Left" Margin="110,6,0,0" VerticalAlignment="Top" Grid.Row="2" />
    82                                                 <Label Content="Overhead (time):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="3" />
     85                                                <Label Content="Overhead (abs):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="3" />
    8386                        <Label Content="{Binding DhtOverheadInReadableTime, FallbackValue=-, Converter={StaticResource TimeSpanToRoundedStringConverter}}" Height="28" HorizontalAlignment="Left" Margin="110,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="3" />
    84                                                 <Label Content="Overhead (percent):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="3" />
     87                                                <Label Content="Overhead (%):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="3" />
    8588                                                <Label Content="{Binding DhtOverheadInPercent, FallbackValue=-}" Height="28" HorizontalAlignment="Left" Margin="120,6,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="3" />
    86                                         </Grid>
     89                        <Label Content="Sent (payload):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="4" />
     90                        <Label Content="{Binding StoredBytes, FallbackValue=-, Converter={StaticResource LongToSizeMetricString}}" Height="28" HorizontalAlignment="Left" Margin="110,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="4" />
     91                        <Label Content="Received (payload):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="4" />
     92                        <Label Content="{Binding RetrievedBytes, FallbackValue=-, Converter={StaticResource LongToSizeMetricString}}" Height="28" HorizontalAlignment="Left" Margin="120,6,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="4" />
     93                        <Label Content="Sent (link):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="5" />
     94                        <Label Content="{Binding SentBytesByLinkManager, FallbackValue=-, Converter={StaticResource LongToSizeMetricString}}" Height="28" HorizontalAlignment="Left" Margin="110,6,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="5" />
     95                        <Label Content="Received (link):" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="5" />
     96                        <Label Content="{Binding ReceivedBytesByLinkManager, FallbackValue=-, Converter={StaticResource LongToSizeMetricString}}" Height="28" HorizontalAlignment="Left" Margin="120,6,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.Row="5" />
     97                    </Grid>
    8798                                </Border>
    8899                <ListView Name="ToplistView" Background="#C8FFFFFF" ItemsSource="{Binding TopList}" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="0,6,0,0" Height="120">
Note: See TracChangeset for help on using the changeset viewer.