Giter Club home page Giter Club logo

performance-counters's Introduction

Qoollo Performance Counters NuGet Build status

Extremely useful library for collecting and tracking performance metrics in your .NET applications.

This library allows you to measure performance of your application by some common metrics and send this values to any target.

Main features:

  • support most commonly used metrics;
  • support several targets to distribute counter values;
  • targets can be combined;
  • XSD schema for configuration section in App.config.

Supported metrics (counter types):

  • Number of Items (example: measure number of received requests);
  • Operations per Second (example: measure performance of your code);
  • Average Count (example: measure average size of queue);
  • Average Time (example: measure average execution time of your functions);
  • Moment Time (example: fixate time of some process that executing only once);
  • Elapsed Time (example: measure the total execution time of your application);
  • Delta (example: measure changes in processing rate);

Supported targets:

  • Internal (values are available only inside your app);
  • Windows Performance Counters (values can be read by windows performance monitor);
  • Network (values are sent to network service);
  • Graphite (values are sent to graphite/carbon server).

Quick start guide

  • add reference to performance counters library;
  • define category with required counters:
internal class TestSingleInstance: SingleInstanceCategoryWrapper
{
    public TestSingleInstance() : base("SingleInstance", "For tests") { }

    [Counter("Test NumberOfItemsCounter")]
    public NumberOfItemsCounter Count { get; private set; }
}
  • define your counters container (if you need a singleton):
internal class PerfCounters: Qoollo.PerformanceCounters.PerfCountersContainer
{
    private static TestSingleInstance _singleInstance = CreateNullCategoryWrapper<TestSingleInstance>();
    public static TestSingleInstance TestSingle { get { return _singleInstance; } }

    public static void Init(CategoryWrapper parent)
    {
        _singleInstance = parent.CreateSubCategory<TestSingleInstance>();
    }
}
  • create counters factory on application start-up and initialize you PerfCounters container:
var counterFactory = new WinCounterFactory();
// or load from App.config:
// var counterFactory = PerfCountersInstantiationFactory.CreateCounterFactoryFromAppConfig("PerfCountersConfigurationSection");

PerfCounters.Init(counterFactory.CreateRootWrapper());
counterFactory.InitAll();
  • use counters like this:
PerfCounters.TestSingle.Count.Increment();
  • don't forget to dispose counters factory when application is closing:
counterFactory.Dispose();

Extended materials

NuGet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.