Click here to Skip to main content
12,500,915 members (47,585 online)
Click here to Skip to main content

Stats

191.8K views
595 downloads
140 bookmarked
Posted

NPerf, A Performance Benchmark Framework for .NET

, 25 Jan 2004
NPerf is a framework for benchmarking classes and methods, that tastes like NUnit.
Release
NPerf.Cons.exe
NPerf.Core.dll
NPerf.Framework.chm
NPerf.Framework.dll
NPerf.Report.dll
scpl.dll
System.Perf.dll
Releases
Unpackaged
nperf-1.1-Release
nperf
bin
Release
nperf-doc-1.1.chm
NPerf.Cons.exe
NPerf.Core.dll
NPerf.Framework.dll
NPerf.Report.dll
scpl.dll
System.Perf.dll
src
build
NAnt
i18n.xsl
ICSharpCode.SharpCvsLib.dll
ICSharpCode.SharpZipLib.dll
log4net.dll
NAnt.Contrib.Tasks.dll
NAnt.Core.dll
NAnt.DotNetTasks.dll
NAnt.exe
NAnt.NUnit.dll
NAnt.NUnit1Tasks.dll
NAnt.NUnit2ReportTasks.dll
NAnt.NUnit2Tasks.dll
NAnt.SourceControlTasks.dll
NAnt.VisualCppTasks.dll
NAnt.VSNetTasks.dll
NAnt.Win32Tasks.dll
NAnt.ZipTasks.dll
NDoc.Core.dll
NDoc.Documenter.Msdn.dll
NDoc.Documenter.NAnt.dll
NUnit-Frame.xsl
NUnit-NoFrame.xsl
nunit.framework.dll
NUnitCore.dll
toolkit.xsl
NPerf.Cons
Collections
App.ico
NPerf.Cons.cmbx
NPerf.Cons.prjx
NPerf.Core
Collections
Monitoring
Tracers
NPerf.Core.cmbx
NPerf.Core.prjx
NPerf.Framework
NPerf.Framework.cmbx
NPerf.Framework.prjx
NPerf.Report
scpl
scpl.dll
System.Perf
NPerf.Framework.chm
nperf.ndoc
nperf.png
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>NPerf.Framework</name>
    </assembly>
    <members>
        <member name="T:NPerf.Framework.NamespaceDoc">
            <summary>
            The <b>NPerf.Framework</b> namespace contains attributes that can be used
            to define performance test classes and methods.
            </summary>
        </member>
        <member name="T:NPerf.Framework.PerfIgnoreAttribute">
            <summary>
            A custom attribute to disable tester or tests
            </summary>
        </member>
        <member name="M:NPerf.Framework.PerfIgnoreAttribute.#ctor(System.String)">
            <summary>
            Default constructor - initializes all fields to default values
            </summary>
        </member>
        <member name="P:NPerf.Framework.PerfIgnoreAttribute.Message">
            <summary>Gets the reason why the test is ignored</summary>
            <value>Explanation of the test ignore</value>
        </member>
        <member name="T:NPerf.Framework.PerfRunDescriptorAttribute">
            <summary>
            Defines a method that returns a description of the current run.
            </summary>
            <remarks name="PerfRunDescriptorAttribute">
<para>
The <see cref="T:NPerf.Framework.PerfRunDescriptorAttribute"/> tags a method that returns
the feature tested value in function of the run index.
</para>
<para>
For instance, if you are testing collections with increasing number of elements,
the feature tested value is the number of elements processed.
</para>
</remarks>
        </member>
        <member name="T:NPerf.Framework.PerfSetUpAttribute">
            <summary>
            Defines a test set-up method.
            </summary>
            <remarks name="PerfSetUpAttribute">
<para>
The SetUp attribute marks a specific method inside a class that has 
already been marked with the <see cref="T:NPerf.Framework.PerfTesterAttribute"/>, 
as a test setup method. 
</para>
<para>
The method takes the test index and the tested type as parameter.
The method must return void.
</para>
<para>
Because of .Net JIT, a first run must be made on the test in order to avoid the
overhead of the compilation. In this case, the testIndex is set to -1.
</para>
</remarks>
            <example name="PerfSetUpTearDownAttribute">
The <see cref="T:NPerf.Framework.PerfSetUpAttribute"/> defines a method that initializes the tester and
tested object. The <see cref="T:NPerf.Framework.PerfTearDownAttribute"/> defines a method that cleans ressources after the test has 
been executed.
<code>using NPerf.Framework;

[PerfTester(typeof(IDictionary),3)]
public DictionaryTester
{
    [PerfSetUp]
    public void SetUp(int testIndex, IDictionary dic)
    {
       // setting up the test
       ...
    }
    
    [PerfTearDown]
    public void TearDown(IDictionary dic)
    {
    }
}</code>
</example>
        </member>
        <member name="T:NPerf.Framework.PerfTearDownAttribute">
            <summary>
            Defines a test tear-down method.
            </summary>
            <remarks name="PerfTearDownAttribute">
<para>
The PerfTearDown attribute marks a specific method inside a class, that has 
already been marked with the <see cref="T:NPerf.Framework.PerfTesterAttribute"/>, 
as a test teardown method. 
</para>
<para>
The method must take the tested type as parameter.
</para>
</remarks>
            <example name="PerfSetUpTearDownAttribute">
The <see cref="T:NPerf.Framework.PerfSetUpAttribute"/> defines a method that initializes the tester and
tested object. The <see cref="T:NPerf.Framework.PerfTearDownAttribute"/> defines a method that cleans ressources after the test has 
been executed.
<code>using NPerf.Framework;

[PerfTester(typeof(IDictionary),3)]
public DictionaryTester
{
    [PerfSetUp]
    public void SetUp(int testIndex, IDictionary dic)
    {
       // setting up the test
       ...
    }
    
    [PerfTearDown]
    public void TearDown(IDictionary dic)
    {
    }
}</code>
</example>
        </member>
        <member name="T:NPerf.Framework.PerfTestAttribute">
            <summary>
            Defines a benchmark test method.
            </summary>
            <!-- No matching elements were found for the following include tag --><include file="NPerf.Framework.Doc.xml" path="doc/remarkss/remarks[@name=&quot;PerfTestAttribute&quot;]"/>
            <example name="PerfTestAttribute">
In this example, we define a test method. 
<code>using NPerf.Framework;

[PerfTester(typeof(IDictionary), 10)]
public DictionaryTester
{
    [PerfTest]
    public void Test(IDictionary dictionary)
    {
       ...
    }
}</code>
</example>
        </member>
        <member name="M:NPerf.Framework.PerfTestAttribute.#ctor">
            <summary>
            Empty constructor
            </summary>
        </member>
        <member name="M:NPerf.Framework.PerfTestAttribute.#ctor(System.String)">
            <summary>
            Constructor with test descrition
            </summary>
            <remarks>
            Constructs the attribute with <paramref name="description"/>.
            </remarks>
            <exception cref="T:System.ArgumentNullException">description is a null reference</exception>
        </member>
        <member name="P:NPerf.Framework.PerfTestAttribute.Description">
            <summary>Gets the Test description string</summary>
            <value>Test description</value>
        </member>
        <member name="T:NPerf.Framework.PerfTesterAttribute">
            <summary>
            A performance tester class attribute.
            </summary>
            <remarks name="PerfTesterAttribute"> 
<para>
This is the attribute that marks a class that contains performance test
methods. This attribute is contained in the NPerf.Framework namespace. 
</para>
<para>
The user must specify the type to which the performance tests are to
be applied. This type is supplied in the constructor.
</para>
</remarks>
            <example name="PerfTesterAttribute">
In this example, we mark a class to benchmark sorter algorithms defined by the <c>ISorter</c> interface,
and that should run 3 times:
<code>using NPerf.Framework;

[PerfTester(typeof(IDictionary),10)]
public class SorterTester
{
   ...
}</code>
A test description, and a featured value description can be specified in the attribute
constructor:
<code>[PerfTester(typeof(IDictionary),10, Description="...", FeatureDescription="...")]
public class SorterTester ...
</code>
</example>
        </member>
        <member name="M:NPerf.Framework.PerfTesterAttribute.#ctor(System.Type,System.Int32)">
            <summary>
            Constructs the attribute
            </summary>
            <param name="testedType">target type</param>
            <param name="testCount">number of test runs</param>
            <exception cref="T:System.ArgumentNullException"><paramref name="testedType"/> is a null reference</exception>
            <exception cref="T:System.ArgumentException"><paramref name="testCount"/> is smaller than 1</exception>
        </member>
        <member name="P:NPerf.Framework.PerfTesterAttribute.TestedType">
            <summary>
            Gets the target type of the tester
            </summary>
            <value>
            Target type of the tester
            </value>
        </member>
        <member name="P:NPerf.Framework.PerfTesterAttribute.TestCount">
            <summary>
            Gets the number of test runs
            </summary>
            <value>
            The number of test runs 
            </value>
        </member>
        <member name="P:NPerf.Framework.PerfTesterAttribute.Description">
            <summary>Gets the Test description string</summary>
            <value>Test description</value>
        </member>
        <member name="P:NPerf.Framework.PerfTesterAttribute.FeatureDescription">
            <summary>Gets the tested feature description string</summary>
            <value>Tested feature description</value>
        </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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Jonathan de Halleux
Engineer
United States United States
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 26 Jan 2004
Article Copyright 2004 by Jonathan de Halleux
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid