Beispiel #1
0
 public void LogData(string description, bool value, PerformanceLogEntryType type) {
     Entries.Add(new Entry {
         Description = description,
         Value = value,
         PerformanceLogEntryType = type
     });
 }
Beispiel #2
0
 public void LogData(string description, bool value, PerformanceLogEntryType type)
 {
     Entries.Add(new Entry {
         Description             = description,
         Value                   = value,
         PerformanceLogEntryType = type
     });
 }
 /// <summary>
 /// Provides an automated wrapper for timing an operation and logging a message to a given PerformanceLog
 /// 
 /// This method should not be used for timing asynchronous operations.
 /// </summary>
 /// <param name="message">The message to log.</param>
 /// <param name="log">The <typeparamref name="PerformanceLog"/> the message should be written to.</param>
 /// <param name="code">The code to be invoked and timed.</param>
 /// <returns><typeparamref name="PerformanceLog"/> which is the same <typeparamref name="PerformanceLog"/> passed into the method.</returns>
 public PerformanceLog LogScope(String message, PerformanceLog log, PerformanceLogEntryType type, CodeBlock code) {
     lock (obj) {
         this.SetMarker();
         code.Invoke();
         this.ReleaseMarker();
         log.LogData(message, this.Duration, type);
     }
     return log;
 }
Beispiel #4
0
 /// <summary>
 /// Provides an automated wrapper for timing an operation and logging a message to a given PerformanceLog
 ///
 /// This method should not be used for timing asynchronous operations.
 /// </summary>
 /// <param name="message">The message to log.</param>
 /// <param name="log">The <typeparamref name="PerformanceLog"/> the message should be written to.</param>
 /// <param name="code">The code to be invoked and timed.</param>
 /// <returns><typeparamref name="PerformanceLog"/> which is the same <typeparamref name="PerformanceLog"/> passed into the method.</returns>
 public PerformanceLog LogScope(String message, PerformanceLog log, PerformanceLogEntryType type, CodeBlock code)
 {
     lock (obj) {
         this.SetMarker();
         code.Invoke();
         this.ReleaseMarker();
         log.LogData(message, this.Duration, type);
     }
     return(log);
 }
Beispiel #5
0
        static void CompareValuesAndLogResults(Person person, Person newPerson, PerformanceLog perfLog, Type streamType, PerformanceLogEntryType type)
        {
            perfLog.LogData(String.Format("newPersonFrom{0}.Name and person.Name are equal", streamType.Name), String.Equals(newPerson.Name, person.Name), type);
            perfLog.LogData(String.Format("newPersonFrom{0}.ID and person.ID are equal", streamType.Name), int.Equals(newPerson.ID, person.ID), type);
            perfLog.LogData(String.Format("newPersonFrom{0}.Email and person.Email are equal", streamType.Name), String.Equals(newPerson.Email, person.Email), type);

            PhoneNumber[] phone    = person.Phone.ToArray();
            PhoneNumber[] newPhone = newPerson.Phone.ToArray();

            for (int i = 0; i < phone.Length; i++)
            {
                perfLog.LogData(String.Format("PhoneNumber[{0}].Number from newPersonFrom{1}.Phone is the same as PhoneNumber[{0}].Number from person{1}.Phone", i, streamType.Name), phone[i].Number.Equals(newPhone[i].Number), type);
                perfLog.LogData(String.Format("PhoneNumber[{0}].Type from newPersonFrom{1}.Phone is the same as PhoneNumber[{0}].Type from person{1}.Phone", i, streamType.Name), phone[i].Type.Equals(newPhone[i].Type), type);
            }
        }