Posts

Showing posts with the label Counters

Java API Wrapper for Windows Performance Counters

Now its time for a quick overview of the Java wrapper API for the Windows Performance Counters. Lifecycle  System Preparation  Library Initialization Counter Caching  Key Retrieval  Counter Usage Time Based Operations Related Posts Lifecycle The lifecycle for these counters is pretty straightforward: System Preparation: creation of counters in the Windows OS. Library Initialization: loading and initializing the library inside your running program Counter caching an optional step that warms up the counter library Key retrieval for any counter you use Counter usage including the API System Preparation You must create any custom counters as Administrator before running any program that uses the Performance Counter system. The simplest way to do this is in a Powershell script because Powershell is available on all modern Windows operating systems.  The following sample script creates a new Category " Freemansoft.JavaTestCategory" and two s...

Recording Java Metrics with the Windows Performance Counters

Image
Example Java Code  Library Performance  Library and Source Code Classspath  CreatingCountersWindowsOperatingSystem  Repository Organization Related Posts Java provides good monitoring through the MBean interface and monitoring tooling. It is nice because it works the same no matter what platform you run on.  There are times when you want to plug into the native performance recording tools especially when running on Windows machines because this makes it easy to integrate your Java application with your Windows based operational consoles. A Java test program generates 2,000,000 performance counter events per second in a single thread and up to 6,500,000 updates per second multi-threaded. (source available on github) This means that counter updates can be made at normal volumes with very little effect on the system. I've created a simple C# library and Java / JNI wrapper that lets you record native Microsoft Windows Performance Counters directly from ...

Windows Performance Counters

Image
Microsoft Windows has a mechanism for recording performance metrics from running applications using the Windows Performance Counters.  This is a high speed system that can be used to gather counts, rats, averages or other numbers based on raw counts or ratios like items/second.  You can see these counters using the perfmon  application.  This system has low overhead and is capable of a high rate of capture. I measured 10 million messages / second  using 4 threads on a 2011 Macbook Pro.  Performance Counters are generated/updated by major system modules and can be extended to include your own modules. Windows 8 comes with over 29,000 standard counters. You can see them by running the typeperf.exe -qx > counterlist.txt.   You can see the Performance counters in action using perfmon. This screen shot shows the  perfmon  application monitoring a cpu performance counter and a custom test performance counter generated by this  c# ...