This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the TimingGroup class which is used to identify to which group…
… a specific timing belongs. This allows separating timings based on their logical area or grouping. references issue #2
- Loading branch information
1 parent
b3fd4e8
commit f2c9e5d
Showing
20 changed files
with
1,017 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/nuclei.diagnostics/Profiling/NonMatchingTimingGroupsException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright company="Nuclei"> | ||
// Copyright 2013 Nuclei. Licensed under the Apache License, Version 2.0. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Runtime.Serialization; | ||
using Nuclei.Diagnostics.Properties; | ||
|
||
namespace Nuclei.Diagnostics.Profiling | ||
{ | ||
/// <summary> | ||
/// An exception thrown when the user tries to use two or more <see cref="ITimerInterval"/> | ||
/// objects with different <see cref="TimingGroup"/> instances. | ||
/// </summary> | ||
[Serializable] | ||
public sealed class NonMatchingTimingGroupsException : Exception | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="NonMatchingTimingGroupsException"/> class. | ||
/// </summary> | ||
public NonMatchingTimingGroupsException() | ||
: this(Resources.Exceptions_Messages_NonMatchingTimingGroups) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="NonMatchingTimingGroupsException"/> class. | ||
/// </summary> | ||
/// <param name="message">The message.</param> | ||
public NonMatchingTimingGroupsException(string message) | ||
: base(message) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="NonMatchingTimingGroupsException"/> class. | ||
/// </summary> | ||
/// <param name="message">The message.</param> | ||
/// <param name="innerException">The inner exception.</param> | ||
public NonMatchingTimingGroupsException(string message, Exception innerException) | ||
: base(message, innerException) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="NonMatchingTimingGroupsException"/> class. | ||
/// </summary> | ||
/// <param name="info"> | ||
/// The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object | ||
/// data about the exception being thrown. | ||
/// </param> | ||
/// <param name="context"> | ||
/// The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information | ||
/// about the source or destination. | ||
/// </param> | ||
/// <exception cref="T:System.ArgumentNullException"> | ||
/// The <paramref name="info"/> parameter is null. | ||
/// </exception> | ||
/// <exception cref="T:System.Runtime.Serialization.SerializationException"> | ||
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). | ||
/// </exception> | ||
private NonMatchingTimingGroupsException(SerializationInfo info, StreamingContext context) | ||
: base(info, context) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright company="Nuclei"> | ||
// Copyright 2013 Nuclei. Licensed under the Apache License, Version 2.0. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Globalization; | ||
|
||
namespace Nuclei.Diagnostics.Profiling | ||
{ | ||
/// <summary> | ||
/// Defines an ID number for groups of timing intervals. | ||
/// </summary> | ||
[Serializable] | ||
public sealed class TimingGroup : Id<TimingGroup, Guid> | ||
{ | ||
/// <summary> | ||
/// Returns a new Guid. | ||
/// </summary> | ||
/// <returns>A new Guid.</returns> | ||
private static Guid Next() | ||
{ | ||
return Guid.NewGuid(); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TimingGroup"/> class. | ||
/// </summary> | ||
public TimingGroup() | ||
: this(Next()) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="TimingGroup"/> class. | ||
/// </summary> | ||
/// <param name="id">The Guid for the ID.</param> | ||
private TimingGroup(Guid id) | ||
: base(id) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Performs the actual act of creating a copy of the current ID number. | ||
/// </summary> | ||
/// <param name="value">The internally stored value.</param> | ||
/// <returns> | ||
/// A copy of the current ID number. | ||
/// </returns> | ||
protected override TimingGroup Clone(Guid value) | ||
{ | ||
return new TimingGroup(value); | ||
} | ||
|
||
/// <summary> | ||
/// Returns a <see cref="System.String"/> that represents this instance. | ||
/// </summary> | ||
/// <returns> | ||
/// A <see cref="System.String"/> that represents this instance. | ||
/// </returns> | ||
public override string ToString() | ||
{ | ||
return string.Format( | ||
CultureInfo.InvariantCulture, | ||
"IntervalGroup: [{0}]", | ||
InternalValue); | ||
} | ||
} | ||
} |
Oops, something went wrong.