Click here to Skip to main content
15,879,474 members
Articles / Web Development / HTML

NTime - Performance unit testing tool

Rate me:
Please Sign up or sign in to vote.
4.73/5 (27 votes)
30 Mar 20066 min read 431.4K   8.2K   163  
An article on a performance testing tool to test an application against its performance
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>NTime.Framework</name>
    </assembly>
    <members>
        <member name="T:NTime.Framework.TimePeriod">
            <summary>
            Time period constants used by <see cref="T:NTime.Framework.TimerHitCountTestAttribute"/> and <see cref="T:NTime.Framework.TimerDurationTestAttribute"/>.
            </summary>
            <example>
            Followed example shows how to set time period to 10 times per second in <see cref="T:NTime.Framework.TimerHitCountTestAttribute"/>.
            <code>
            [TimerHitCountTest(10, Unit = TimePeriod.Second)]
            </code>
            </example>
            <remarks>Time periods are customizable units for different time frames of code performance tests.
            Sometimes you need to keep your hit count of method execution to be not less than 300 times per second, this
            would be typical scenario for real server applications. Other time frame would be used in critical sections, therefore
            time period should be set to nanoseconds probably.
            </remarks>
        </member>
        <member name="F:NTime.Framework.TimePeriod.Nanosecond">
            <summary>
            Time period is set to one nanosecond. Use this value in critical sections to collect performance test.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimePeriod.Microsecond">
            <summary>
            Time period is set to one microsecond. This is default value for <see cref="T:NTime.Framework.TimerDurationTestAttribute"/>.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimePeriod.Millisecond">
            <summary>
            Time period is set to one millisecond.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimePeriod.Second">
            <summary>
            Time period is set to one second. This is default value for <see cref="T:NTime.Framework.TimerHitCountTestAttribute"/>.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimePeriod.Minute">
            <summary>
            Time period is set to one minute. You can use this value in complex task as database transactions.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimePeriod.Hour">
            <summary>
            Time period is set to one hour.
            </summary>
        </member>
        <member name="T:NTime.Framework.TimerFixtureAttribute">
            <summary>
            Specifies timing usage for user class.
            This class cannot be inherited.
            </summary>
            <remarks>This is main attribute your class must have to enable perfomance tests.
            </remarks>
            <example>Mark your class as follow, to make it dedicated to run performance tests.
            <code>
            [TimerFixture]
            public class ServerPerformanceTest
            {
            	...
            }
            </code></example>
        </member>
        <member name="T:NTime.Framework.TimerHitCountTestAttribute">
            <summary>
            Specifies hit count test for the method.
            This class cannot be inherited.
            </summary>
            <remarks>This attribute marks methods in <see cref="T:NTime.Framework.TimerFixtureAttribute"/> attributed class to provide
            hit count performance tests in methods. Performance is completed when hit count is above minimum value per certain time period, otherwise test fails.
            It is useful performance test to keep your application code more responsible to clients. Default time period is one second.</remarks>
            <example>Attribute method for hit count performance test of minimum 20 calls per millisecond is shown below.
            <code>
            [TimerFixture]
            public class TestPerformance
            {
            	[TimerHitCountTest(20, Unit = Millisecond)]
            	public void RunTest()
            	{
            		...
            	}
            }
            </code></example>
        </member>
        <member name="F:NTime.Framework.TimerHitCountTestAttribute.ExpectedHits">
            <summary>
            Minimum hits per second (or other time period) that must occur, otherwise performance test fails.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerHitCountTestAttribute.Threads">
            <summary>
            Number of concurrent threads that call method.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerHitCountTestAttribute.Unit">
            <summary>
            Time period for hit count calculating.
            </summary>
        </member>
        <member name="M:NTime.Framework.TimerHitCountTestAttribute.#ctor(System.Int32)">
            <summary>
            Initializes a new instance of attribute class to enable method hit count test.
            Optionally specify <see cref="F:NTime.Framework.TimerHitCountTestAttribute.Threads"/> for multithreaded tests and
            <see cref="F:NTime.Framework.TimerHitCountTestAttribute.Unit"/> with one of available <see cref="T:NTime.Framework.TimePeriod"/> constant to change time unit (defaults to second).
            </summary>
            <param name="expectedHits">Minimum hits per second (or other time period) that must occur, otherwise performance test fails.</param>
        </member>
        <member name="T:NTime.Framework.TimerDurationTestAttribute">
            <summary>
            Specifies duration test.
            This class cannot be inherited.
            </summary>
            <remarks>This attribute marks methods in <see cref="T:NTime.Framework.TimerFixtureAttribute"/> class to provide
            duration performance tests. Performance test is completed when time execution is less than minimum provided time in certain time unit, otherwise test fails.
            It is useful performance test to keep your application code run fast. Default time unit is microseconds.</remarks>
            <example>Attribute method for duration performance test of maximum 60 nanoseconds is shown below.
            <code>
            [TimerFixture]
            public class TestPerformance
            {
            	[TimerDurationTest(60, Unit = Nanosecond)]
            	public void RunTest()
            	{
            		...
            	}
            }
            </code></example>
        </member>
        <member name="F:NTime.Framework.TimerDurationTestAttribute.Duration">
            <summary>
            Minimum time (defaults to microseconds) the method has to be executed, otherwise performance test fails.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerDurationTestAttribute.Threads">
            <summary>
            Number of concurrent threads that call method.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerDurationTestAttribute.Unit">
            <summary>
            Time period for duration test.
            </summary>
        </member>
        <member name="M:NTime.Framework.TimerDurationTestAttribute.#ctor(System.Int32)">
            <summary>
            Initializes attribute class for method time execution.
            Optionally specify <see cref="F:NTime.Framework.TimerDurationTestAttribute.Threads"/> for multithreaded tests and
            <see cref="F:NTime.Framework.TimerDurationTestAttribute.Unit"/> with one of available <see cref="T:NTime.Framework.TimePeriod"/> constant to change measure (defaults to microseconds).
            </summary>
            <param name="duration">Minimum time (defaults to microseconds) the method has to be executed, otherwise performance test fails.</param>
        </member>
        <member name="T:NTime.Framework.TimerCounterTestAttribute">
            <summary>
            Specifies method to test against performance counters.
            This class cannot be inherited.
            </summary>
            <remarks>This attribute marks methods in <see cref="T:NTime.Framework.TimerFixtureAttribute"/> class to provide
            custom performance counter tests in methods. Performance test is completed when average performance counter value is in range of minimum and maximum value set (set at least one value), otherwise test fails.
            It is useful performance test to keep your application run smoothly with many performance counter checks. For more information refer to <see cref="T:System.Diagnostics.PerformanceCounter"/>.
            Note that you can specify in a special string '*' in member <see cref="F:NTime.Framework.TimerCounterTestAttribute.InstanceName"/> to fetch actual application name i.e. either NTimeGUI or NTime.
            </remarks>
        </member>
        <member name="F:NTime.Framework.TimerCounterTestAttribute.CategoryName">
            <summary>
            The name of the performance counter category for performance counter.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerCounterTestAttribute.CounterName">
            <summary>
            The name of the performance counter that is associated with PerformanceCounter instance.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerCounterTestAttribute.InstanceName">
            <summary>
            The instance name for performance counter, note that you can specify here special string '*' to fetch actual application name i.e. either NTimeGUI or NTime.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerCounterTestAttribute.MachineName">
            <summary>
            The computer name for performance counter. Do not use this member, because is not supported.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerCounterTestAttribute.Threads">
            <summary>
            Number of concurrent threads that call method.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerCounterTestAttribute.MinimumValue">
            <summary>
            Minimum value that performance counter may have to accept performance test.
            </summary>
        </member>
        <member name="F:NTime.Framework.TimerCounterTestAttribute.MaximumValue">
            <summary>
            Maximum value that performance counter may have to accept performance test.
            </summary>
        </member>
        <member name="M:NTime.Framework.TimerCounterTestAttribute.#ctor(System.String,System.String)">
            <summary>
            Initializes attribute class to test method against performance counters.
            Optionally specify <see cref="F:NTime.Framework.TimerCounterTestAttribute.Threads"/> for multithreaded
            tests, <see cref="F:NTime.Framework.TimerCounterTestAttribute.InstanceName"/>, <see cref="F:NTime.Framework.TimerCounterTestAttribute.MachineName"/>,
            minimum and/or maximum acceptable value for perfomance counter <see cref="F:NTime.Framework.TimerCounterTestAttribute.MinimumValue"/>, <see cref="F:NTime.Framework.TimerCounterTestAttribute.MaximumValue"/>.
            See also <see cref="T:System.Diagnostics.PerformanceCounter"/> class.
            <seealso cref="T:System.Diagnostics.PerformanceCounter"/>
            </summary>
            <param name="categoryName">The name of the performance counter category for performance counter.</param>
            <param name="counterName">The name of the performance counter that is associated with PerformanceCounter instance.</param>
        </member>
        <member name="T:NTime.Framework.TimerSetUpAttribute">
            <summary>
            Specifies place to set up environment with TimerFixture class.
            This class cannot be inherited.
            </summary>
            <remarks>This attribute when used with method prepares additional set up for your performance test methods.
            It is not required to specify this attribute always, some methods may still work without TimerSetUp attribute.
            Every <see cref="T:NTime.Framework.TimerFixtureAttribute"/> class may have its own TimerSetUpAttribute or <see cref="T:NTime.Framework.TimerTearDownAttribute"/> as well.</remarks>
            <example>Mark your class as follows:
            <code>
            [TimerSetUp]
            public void PerformanceSetUpRoutine
            {
            	...
            }
            </code></example>
        </member>
        <member name="T:NTime.Framework.TimerTearDownAttribute">
            <summary>
            Specifies place to tear down environment with TimerFixture class.
            This class cannot be inherited.
            </summary>
            <remarks>This attribute when used with method frees additional objects created by <see cref="T:NTime.Framework.TimerSetUpAttribute"/> class.
            It is not required to specify this attribute always, some methods may still work without TimerTearDown attribute.
            Every <see cref="T:NTime.Framework.TimerFixtureAttribute"/> class may have its own TimerTearDownAttribute or <see cref="T:NTime.Framework.TimerSetUpAttribute"/> as well.</remarks>
            <example>Mark your class as follows:
            <code>
            [TimerTearDown]
            public void PerformanceTearDownRoutine
            {
            	...
            }
            </code></example>
        </member>
        <member name="T:NTime.Framework.TimerFixtureSetUpAttribute">
            <summary>
            Specifies place for global set up environment for whole performance test.
            This class cannot be inherited.
            </summary>
            <remarks>This attribute when used with method prepares main set up for your performance test.
            It is not required to specify this attribute.</remarks>
            <example>Mark your class as follows:
            <code>
            [TimerFixtureSetUp]
            public void PerformanceGlobalSetUpRoutine
            {
            	...
            }
            </code></example>
        </member>
        <member name="T:NTime.Framework.TimerFixtureTearDownAttribute">
            <summary>
            Specifies place to globally tear down environment for whole performance test.
            This class cannot be inherited.
            </summary>
            <remarks>This attribute when used with method at the end of performance test frees additional objects created by <see cref="T:NTime.Framework.TimerFixtureSetUpAttribute"/> class.
            It is not required to specify this attribute.</remarks>
            <example>Mark your class as follows:
            <code>
            [TimerFixtureTearDown]
            public void PerformanceGlobalTearDownRoutine
            {
            	...
            }
            </code></example>
        </member>
        <member name="T:NTime.Framework.TimerIgnoreAttribute">
            <summary>
            Instructs performance test tool to skip performance test and mark it as a warning information.
            This class cannot be inherited.
            </summary>
            <remarks>Code you are working on sometimes may be not optimized to pass it by performance test, therefore
            you should replace actually marked test attribute with TimerIgnore attribute for this reason.</remarks>
            <example>Mark your class as follows:
            <code>
            // [TimerHitCountTest(20, Unit = Millisecond)] // removed from performance check
            [TimerIgnore("Implementing new algorithm since it's crashing for now")]
            public void QuickSort
            {
            	...
            }
            </code></example>
        </member>
        <member name="F:NTime.Framework.TimerIgnoreAttribute.Info">
            <summary>
            Warning text in performance test tool to indicate that method cannot be checked against perfomance test due to some algorithm problems.
            </summary>
        </member>
        <member name="M:NTime.Framework.TimerIgnoreAttribute.#ctor(System.String)">
            <summary>
            Initializes attribute class to disable performance test and generate warning information.
            </summary>
            <param name="ignoreInfo">Sets warning text in performance test tool to indicate that method cannot be checked against perfomance test due to some algorithm problems.</param>
        </member>
    </members>
</doc>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Web Developer
Poland Poland
Born in Poland, living there as employeed developer, in free time writing much .net stuff and designing applications.

Comments and Discussions