Changeset 1244


Ignore:
Timestamp:
Mar 17, 2010, 12:35:57 PM (12 years ago)
Author:
arnold
Message:

For evaluation issues added a DateTime information to every LogMessage from P2P- and KeySearcher-PlugIns, because the LogMessages seems to be inaccurate and/or delayed in some cases

Additionally added a Begin- and End-Message into the KeySearcher with an TimeSpan information, how long the bruteforce process had taken

Location:
trunk/CrypPlugins
Files:
9 edited

Legend:

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

    r1216 r1244  
    539539        private LinkedList<ValueKey> bruteforcePattern(KeyPattern pattern, IControlEncryption sender)
    540540        {
     541            //For evaluation issues - added by Arnold 2010.03.17
     542            DateTime beginBruteforcing = DateTime.Now;
     543            GuiLogMessage("Start bruteforcing pattern '" + pattern.getKey() + "'", NotificationLevel.Debug);
     544
     545
     546                       
    541547            int maxInList = 10;
    542548            LinkedList<ValueKey> costList = new LinkedList<ValueKey>();
     
    634640                ProgressChanged(1, 1);
    635641
     642            /* BEGIN: For evaluation issues - added by Arnold 2010.03.17 */
     643            TimeSpan bruteforcingTime = DateTime.Now.Subtract(beginBruteforcing);
     644            StringBuilder sbBFTime = new StringBuilder();
     645            if (bruteforcingTime.Days > 0)
     646                sbBFTime.Append(bruteforcingTime.Days.ToString() + " days ");
     647            if (bruteforcingTime.Hours > 0)
     648            {
     649                if (bruteforcingTime.Hours <= 9)
     650                    sbBFTime.Append("0");
     651                sbBFTime.Append(bruteforcingTime.Hours.ToString() + ":");
     652            }
     653            if (bruteforcingTime.Minutes <= 9)
     654                sbBFTime.Append("0");
     655            sbBFTime.Append(bruteforcingTime.Minutes.ToString() + ":");
     656            if (bruteforcingTime.Seconds <= 9)
     657                sbBFTime.Append("0");
     658            sbBFTime.Append(bruteforcingTime.Seconds.ToString() + "-");
     659            if (bruteforcingTime.Milliseconds <= 9)
     660                sbBFTime.Append("00");
     661            if (bruteforcingTime.Milliseconds <= 99)
     662                sbBFTime.Append("0");
     663            sbBFTime.Append(bruteforcingTime.Milliseconds.ToString());
     664
     665            GuiLogMessage("Ended bruteforcing pattern '" + pattern.getKey() + "'. Bruteforcing TimeSpan: " + sbBFTime.ToString(), NotificationLevel.Debug);
     666            /* END: For evaluation issues - added by Arnold 2010.03.17 */
     667
    636668            return costList;
    637669        }
  • trunk/CrypPlugins/PeerToPeerBase/DebugToFile.cs

    r981 r1244  
    8282            }
    8383        }
     84
     85        // method only necessary for evaluation issues
     86        public static string GetTimeStamp()
     87        {
     88            DateTime now = DateTime.Now;
     89            StringBuilder sbTimeStamp = new StringBuilder();
     90
     91            if (now.Hour <= 9)
     92                sbTimeStamp.Append("0");
     93            sbTimeStamp.Append(now.Hour.ToString() + ".");
     94            if (now.Minute <= 9)
     95                sbTimeStamp.Append("0");
     96            sbTimeStamp.Append(now.Minute.ToString() + ".");
     97            if (now.Second <= 9)
     98                sbTimeStamp.Append("0");
     99            sbTimeStamp.Append(now.Second.ToString() + ":");
     100            if (now.Millisecond <= 9)
     101                sbTimeStamp.Append("00");
     102            else if (now.Millisecond <= 99)
     103                sbTimeStamp.Append("0");
     104            sbTimeStamp.Append(now.Millisecond.ToString());
     105
     106            return sbTimeStamp.ToString();
     107        }
    84108    }
    85109}
  • trunk/CrypPlugins/PeerToPeerBase/P2PPeer.cs

    r1212 r1244  
    160160        private void GuiLogMessage(string p, NotificationLevel notificationLevel)
    161161        {
    162             EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p, this, notificationLevel));
     162            // for evaluation issues only
     163            EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p + "(" + DebugToFile.GetTimeStamp() + ")", this, notificationLevel));
     164            //EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(p, this, notificationLevel));
    163165        }
    164166
  • trunk/CrypPlugins/PeerToPeerJobs/IDistributableJob.cs

    r1199 r1244  
    3636        event LastResultReceived OnLastResultReceived;
    3737
    38 
    3938        /// <summary>
    4039        /// pops a new serialized JobPart and the JobParts' JobId.
  • trunk/CrypPlugins/PeerToPeerManager_NEW/P2PManagerBase_NEW.cs

    r1220 r1244  
    155155            else
    156156            {
    157                 GuiLogging("Manager can't be started, because P2P-Peer- or Distributable-Job-PlugIn isn't connected with the Manager or the connection is broken...", NotificationLevel.Warning);
     157                GuiLogging("Manager couldn't be started, because P2P-Peer- or Distributable-Job-PlugIn isn't connected with the Manager or the connection is broken...", NotificationLevel.Warning);
    158158            }
    159159        }
     
    462462                        OnNewJobAllocated(temp_jobId);
    463463
    464                     GuiLogging("Job '" + temp_jobId.ToString() + "' were sent to worker id '" + worker.ToString() + "'", NotificationLevel.Info);
     464                    GuiLogging("Job '" + temp_jobId.ToString() + "' was sent to worker id '" + worker.ToString() + "'", NotificationLevel.Info);
    465465                    i++;
    466466                }
  • trunk/CrypPlugins/PeerToPeerManager_NEW/P2PManager_KeyPattern.cs

    r1223 r1244  
    422422            if (this.p2pControl == null)
    423423                return;
    424             if (e.PropertyName == "BtnUnregister")
     424            if (e.PropertyName == "BtnStop")
    425425            {
    426426                if (this.p2pManager != null && this.p2pManager.Started)
     
    428428                    Stop();
    429429                    //this.p2pManager.Stop(PubSubMessageType.Unregister);
    430                     GuiLogMessage("Unregister button pressed, Publisher has stopped!", NotificationLevel.Info);
    431                 }
    432             }
    433             if (e.PropertyName == "BtnRegister")
     430                    GuiLogMessage("Stop button pressed, Manager has been stopped!", NotificationLevel.Info);
     431                }
     432            }
     433            if (e.PropertyName == "BtnStart")
    434434            {
    435435                if (this.p2pManager == null || !this.p2pManager.Started)
    436436                {
    437437                    this.process(this.EncryptionControl);
    438                     GuiLogMessage("Register button pressed, Publisher has been started!", NotificationLevel.Info);
    439                 }
    440             }
    441             if (e.PropertyName == "BtnSolutionFound")
    442             {
    443                 if (this.p2pManager != null && this.p2pManager.Started)
    444                 {
    445                     Stop();
    446                     //this.p2pManager.Stop(PubSubMessageType.Solution);
    447                     GuiLogMessage("TEST: Emulate Solution-Found-message", NotificationLevel.Info);
     438                    GuiLogMessage("Start button pressed, Manager will be return job distribution!", NotificationLevel.Info);
    448439                }
    449440            }
     
    590581                }
    591582
     583                GuiLogMessage("Begin creating a new distributable KeyPatternJob. (" + DebugToFile.GetTimeStamp() + ")", NotificationLevel.Debug);
     584
    592585                // create a new DistributableJob instance
    593586                distributableKeyPatternJob = new DistributableKeyPatternJob
    594587                    (kp, this.settings.KeyPatternSize * 10000, byteEncryptedData, this.InitVector);
     588
     589                GuiLogMessage("Ended creating a new distributable KeyPatternJob. (" + DebugToFile.GetTimeStamp() + ")", NotificationLevel.Debug);
    595590
    596591                //set progress chunk job count
  • trunk/CrypPlugins/PeerToPeerManager_NEW/P2PManager_KeyPatternSettings.cs

    r1199 r1244  
    7777
    7878        /* FOR TESTING ISSUES */
    79         [TaskPane("Unregister", "Click here to Unregister the publisher from all registered subscribers!", "Control region", 0, true, DisplayLevel.Beginner, ControlType.Button)]
    80         public void BtnUnregister()
     79        [TaskPane("Stop", "Click here to Stop the Manager pro-active with all formely registered Workers!", "Control region", 0, true, DisplayLevel.Beginner, ControlType.Button)]
     80        public void BtnStop()
    8181        {
    8282            TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnSolutionFound", Visibility.Collapsed)));
    83             TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnUnregister", Visibility.Collapsed)));
    84             TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnRegister", Visibility.Visible)));
    85             OnPropertyChanged("BtnUnregister");
    86         }
    87         [TaskPane("Register", "Click here to Register the publisher pro-active with all formely registered subscribers!", "Control region", 1, true, DisplayLevel.Beginner, ControlType.Button)]
    88         public void BtnRegister()
     83            TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnStop", Visibility.Collapsed)));
     84            TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnStart", Visibility.Visible)));
     85            OnPropertyChanged("BtnStop");
     86        }
     87        [TaskPane("Start", "Click here to (Re)Start the Manager; it will be return with the last status!", "Control region", 1, true, DisplayLevel.Beginner, ControlType.Button)]
     88        public void BtnStart()
    8989        {
    9090            TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnSolutionFound", Visibility.Visible)));
    91             TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnRegister", Visibility.Collapsed)));
    92             TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnUnregister", Visibility.Visible)));
    93             OnPropertyChanged("BtnRegister");
    94         }
    95         [TaskPane("Solution found", "TESTING: Emulate solution-found-case!", "Control region", 2, true, DisplayLevel.Beginner, ControlType.Button)]
    96         public void BtnSolutionFound()
    97         {
    98             TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnSolutionFound", Visibility.Collapsed)));
    99             TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnUnregister", Visibility.Collapsed)));
    100             TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnRegister", Visibility.Visible)));
    101             OnPropertyChanged("BtnSolutionFound");
    102         }
     91            TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnStart", Visibility.Collapsed)));
     92            TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer("BtnStop", Visibility.Visible)));
     93            OnPropertyChanged("BtnStart");
     94        }       
    10395        /* FOR TESTING ISSUES */
    10496
  • trunk/CrypPlugins/PeerToPeerPublisher/P2PPublisherBase.cs

    r1223 r1244  
    361361        protected void GuiLogging(string sText, NotificationLevel notLev)
    362362        {
    363             if(OnGuiMessage != null)
    364                 OnGuiMessage(sText, notLev);
     363            if (OnGuiMessage != null)
     364            {
     365                // for evaluation issues, DateTime is added
     366                OnGuiMessage(sText + "(" + DebugToFile.GetTimeStamp() + ")", notLev);
     367                //OnGuiMessage(sText, notLev);
     368            }
    365369        }
    366370
  • trunk/CrypPlugins/PeerToPeerSubscriber/P2PSubscriberBase.cs

    r1220 r1244  
    381381        {
    382382            if (OnGuiMessage != null)
    383                 OnGuiMessage(sText, notLev);
     383            {
     384                // for evaluation issues, DateTime is added
     385                OnGuiMessage(sText + "(" + DebugToFile.GetTimeStamp() + ")", notLev);
     386                //OnGuiMessage(sText, notLev);
     387            }
    384388        }
    385389    }
Note: See TracChangeset for help on using the changeset viewer.