Monitoring Application Performance on the .NET Compact Framework Part VI - Version 2 performance counters (Part IV: Garbage Collector counters)
Today's post is the fourth in the series of .NET Compact Framework v2 performance counters. For a complete listing of the previous installments, please see the list below.
Pre-requisite:
Monitoring Application Performance on the .NET Compact Framework Part I - Enabling performance counters
.NET Compact Framework Version 1:
Monitoring Application Performance on the .NET Compact Framework Part II - Version 1 performance counters
.NET Compact Framework Version 2:
Monitoring Application Performance on the .NET Compact Framework Part III - Version 2 performance counters (Part I: Loader counters)
Monitoring Application Performance on the .NET Compact Framework Part IV - Version 2 performance counters (Part II: Generics counters)
Monitoring Application Performance on the .NET Compact Framework Part V - Version 2 performance counters (Part III: Locks and Threads counters)
The following table lists all of the performance counters available in version 2 of the .NET Compact Framework. The counters highlighted, in yellow, are the ones I will be talking about today.
Loader | |
Total Program Run Time (ms) | |
App Domains Created | |
App Domains Unloaded | |
Assemblies Loaded | |
Classes Loaded | |
Methods Loaded | |
Generics | |
Closed Types Loaded | |
Closed Types Loaded per Definition | |
Open Types Loaded | |
Closed Methods Loaded | |
Closed Methods Loaded per Definition | |
Open Methods Loaded | |
Locks and Threads | |
Threads in Thread Pool | |
Pending Timers | |
Scheduled Timers | |
Timers Delayed by Thread Pool Limit | |
Work Items Queued | |
Uncontested Monitor.Enter Calls | |
Contested Monitor.Enter Calls | |
Garbage Collector | |
Peak Bytes Allocated (native + managed) | |
Managed Objects Allocated | |
Managed Bytes Allocated | |
Managed String Objects Allocated | |
Bytes of String Objects Allocated | |
Garbage Collections (GC) | |
Bytes Collected By GC | |
Managed Bytes In Use After GC | |
Total Bytes In Use After GC | |
GC Compactions | |
Code Pitchings | |
Calls to GC.Collect | |
GC Latency Time (ms) | |
Pinned Objects | |
Objects Moved by Compactor | |
Objects Not Moved by Compactor | |
Objects Finalized | |
Boxed Value Types | |
Process Heap | |
Short Term Heap | |
JIT Heap | |
App Domain Heap | |
GC Heap | |
JIT Compiler | |
Native Bytes Jitted | |
Methods Jitted | |
Bytes Pitched | |
Methods Pitched | |
Method Pitch Latency Time (ms) | |
Exceptions | |
Exceptions Thrown | |
Interop | |
Platform Invoke Calls | |
COM Calls Using a vtable | |
COM Calls Using IDispatch | |
Complex Marshaling | |
Runtime Callable Wrappers | |
Networking | |
Socket Bytes Sent | |
Socket Bytes Received | |
Windows.Forms | |
Controls Created | |
Brushes Created | |
Pens Created | |
Bitmaps Created | |
Regions Created | |
Fonts Created | |
Graphics Created (FromImage) | |
Graphics Created (CreateGraphics) |
The statistics file includes running totals, the most recent value (last datum), count (n), average (mean), minimum and maximum values for the counters. I've included an example file at the end of this post. For counters where a given column is not relevant, a hyphen (-) is logged.
I will use the following format to describe each counter.
Counter name
Brief description of the counter
Discussion of the contents of relevant columns (total, last datum, n, mean, min, max)
Any additional comments relating to the counter
Garbage Collector Counters
Today's counters relate to memory usage and the .NET Compact Framework Garbage Collector. From version 1 to version 2, the Garbage Collector counters have been refined a great deal. The version 2 counters provide significantly more detailed insight into application memory usage and make identifying memory related performance issues much easier.
For information on the .NET Compact Framework Garbage Collector, please see Steven Pratschner's post: An Overview of the .NET Compact Framework Garbage Collector.
Peak Bytes Allocated (native + managed)
The maximum number of bytes in use by the .NET Compact Framework including both native and managed memory.
total: The largest number of bytes used at any time during the runtime of the application
Managed Objects Allocated
The count of all managed objects that have been allocated (including unused objects).
total: Running total of managed objects allocated
Managed Bytes Allocated
The count of bytes allocated for managed objects.
total: Running total of bytes allocated
last datum: The size of the most recent allocation
n: The number of allocations
mean: The average size of the allocations
min: The smallest number of bytes allocated
max: The largest number of bytes allocated
Managed String Objects Allocated
The count of string objects that have been allocated.
total: Running total of managed string objects
Bytes of String Objects Allocated
The count of bytes allocated for managed string objects.
total: Running total of bytes allocated
Garbage Collections (GC)
The number of times the Garbage Collector ran during the run time of your application.
total: Running total of collections
Bytes Collected By GC
The count of bytes collected by the Garbage Collector.
total: Running total of bytes collected by the Garbage Collector
last datum: The size of the most recent collection
n: The number of collections
mean: The average size of the collections
min: The size of the smallest collection
max: The size of the largest collection
Managed Bytes In Use After GC
The number of bytes allocated to live objects after the Garbage Collector has run.
last datum: The number of managed bytes in use after the most recent collection
n: The number of collections
mean: The average number of bytes in use after the collections
min: The fewest number of bytes in use after a collection
max: The largest number of bytes in use after a collection
Total Bytes In Use After GC
The number of bytes (managed and native) in use after the Garbage Collector has run
last datum: The number of bytes in use after the most recent collection
n: The number of collections
mean: The average number of bytes in use after the collections
min: The fewest number of bytes in use after a collection
max: The largest number of bytes in use after a collection
GC Compactions
The number of times the Garbage Collector has compacted the heap.
total: Running total of heap compactions by the Garbage Collector
Code Pitchings
The number of times the Garbage Collector has pitched Just-In-Time (JIT) compiled code.
total: Running total of code pitchings
Calls to GC.Collect
The number of times the application has called the GC.Collect() method
total: Running total of calls to GC.Collect()
For a detailed discussion of the issues surrounding GC.Collect(), please see Scott Holden's post: The perils of GC.Collect.
GC Latency Time (ms)
The time (in milliseconds) that the Garbage Collector has taken to run.
total: Running total of time spent in collection
last datum: The time it took for the most recent collection to complete
n: The number of garbage collections
mean: The average time spent in collections
min: The shortest time it took to perform a collection
max: The longest time it took to perform a collection
Please note that the latency time of the Garbage Collector includes collection of managed objects which are no longer in scope and the compaction (if necessary) of the GC Heap.
Pinned Objects
The number of pinned objects that were encountered by the Garbage Collector.
total: Running total of pinned objects
Pinned objects are objects whose locations in memory cannot change. A good example of such an object is a memory buffer that is being used to communicate between managed and unmanaged (native) code. Pinned objects cannot be moved by the Garbage Collector during heap compaction.
Objects Moved by Compactor
The count of objects that were moved by the Garbage Collector during a compaction.
total: Running total of objects moved during compaction
Objects Not Moved by Compactor
The count of objects that cannot be moved or were not moved by the Garbage Collector during a compaction.
total: Running total of objects not moved during compaction
Objects might not be moved for a number of reasons. Some objects cannot be moved (this is rare). Other objects are not moved because they are in a portion of the heap which does not need to be compacted.
Objects Finalized
The number of objects for which a finalizer has been run.
total: Running total of finalized objects
More information on the Finalize method can be found in the .NET Programmers Reference on MSDN. A good discussion on implementing finalization in your objects can be found in the Implementing Finalize and Dispose to Clean Up Unmanaged Resources article (also on MSDN).
Boxed Value Types
The number of value types that have been boxed.
total: Running total of boxed value types
A good reference on boxing of value types can be found in the C# Programmers Reference on MSDN. Scott Holden also has a nice discussion on The cost of value types in the .NET Compact Framework.
Process Heap
The number of bytes in use by the .NET Compact Framework Common Language Runtime's default heap.
last datum: The current number of bytes in the heap
n: The number of allocations in the heap
mean: The average number of bytes in the heap
min: The smallest number of bytes in the heap (throughout the runtime of the application)
max: The largest number of bytes in the heap (throughout the runtime of the application)
The Process Heap contains memory allocated by the .NET Compact Framework's Common Language Runtime that does not fit into the other heaps (Short Term, JIT, App Domain, GC).
Short Term Heap
The number of bytes in use by the .NET Compact Framework Common Language Runtime's short term heap.
last datum: The current number of bytes in the heap
n: The number of allocations in the heap
mean: The average number of bytes in the heap
min: The smallest number of bytes in the heap (throughout the runtime of the application)
max: The largest number of bytes in the heap (throughout the runtime of the application)
The Short Term Heap contains memory allocated by the .NET Compact Framework Common Language Runtime for short lived (temporary) use.
JIT Heap
The number of bytes in use by the .NET Compact Framework Just-In-Time (JIT) compiler's heap.
last datum: The current number of bytes in the heap
n: The number of allocations in the heap
mean: The average number of bytes in the heap
min: The smallest number of bytes in the heap (throughout the runtime of the application)
max: The largest number of bytes in the heap (throughout the runtime of the application)
The JIT heap contains the native code generated when the .NET Compact Framework Just-In-Time compiler compiles a managed method. JIT compilation occurs whenever a managed method is executed for the first time (or the first time a method is executed after a code pitching).
App Domain Heap
The number of bytes in use by the .NET Compact Framework Common Language Runtime's App Domain heap.
last datum: The current number of bytes in the heap
n: The number of allocations in the heap
mean: The average number of bytes in the heap
min: The smallest number of bytes in the heap (throughout the runtime of the application)
max: The largest number of bytes in the heap (throughout the runtime of the application)
The App Domain Heap contains the dynamic representation of metadata used by the .NET Compact Framework Common Language Runtime's assembly loader.
GC Heap
The number of bytes in use by the .NET Compact Framework's Garbage Collector heap.
last datum: The current number of bytes in the heap
n: The number of allocations in the heap
mean: The average number of bytes in the heap
min: The smallest number of bytes in the heap (throughout the runtime of the application)
max: The largest number of bytes in the heap (throughout the runtime of the application)
The GC Heap contains memory allocated by applications and the .NET Compact Framework.
Example statistics file
I have highlighted the counters discussed here with a yellow background.
counter | total | last datum | n | mean | min | max |
Total Program Run Time (ms) | 2956837 | - | - | - | - | - |
App Domains Created | 1 | - | - | - | - | - |
App Domains Unloaded | 1 | - | - | - | - | - |
Assemblies Loaded | 8 | - | - | - | - | - |
Classes Loaded | 975 | - | - | - | - | - |
Methods Loaded | 3015 | - | - | - | - | - |
Closed Types Loaded | 75 | - | - | - | - | - |
Closed Types Loaded per Definition | 75 | 3 | 22 | 3 | 1 | 10 |
Open Types Loaded | 13 | - | - | - | - | - |
Closed Methods Loaded | 3 | - | - | - | - | - |
Closed Methods Loaded per Definition | 3 | 1 | 3 | 1 | 1 | 1 |
Open Methods Loaded | 0 | - | - | - | - | - |
Threads in Thread Pool | - | 0 | 2 | 0 | 0 | 1 |
Pending Timers | - | 0 | 4 | 0 | 0 | 1 |
Scheduled Timers | 2 | - | - | - | - | - |
Timers Delayed by Thread Pool Limit | 0 | - | - | - | - | - |
Work Items Queued | 2 | - | - | - | - | - |
Uncontested Monitor.Enter Calls | 664 | - | - | - | - | - |
Contested Monitor.Enter Calls | 0 | - | - | - | - | - |
Peak Bytes Allocated (native + managed) | 2789048 | - | - | - | - | - |
Managed Objects Allocated | 25883 | - | - | - | - | - |
Managed Bytes Allocated | 1366120 | 24 | 25883 | 52 | 8 | 135796 |
Managed String Objects Allocated | 5360 | - | - | - | - | - |
Bytes of String Objects Allocated | 124412 | - | - | - | - | - |
Garbage Collections (GC) | 1 | - | - | - | - | - |
Bytes Collected By GC | 897140 | 897140 | 1 | 897140 | 897140 | 897140 |
Managed Bytes In Use After GC | - | 147292 | 1 | 147292 | 147292 | 147292 |
Total Bytes In Use After GC | - | 2621848 | 1 | 2621848 | 2621848 | 2621848 |
GC Compactions | 0 | - | - | - | - | - |
Code Pitchings | 0 | - | - | - | - | - |
Calls to GC.Collect | 0 | - | - | - | - | - |
GC Latency Time (ms) | 46 | 46 | 1 | 46 | 46 | 46 |
Pinned Objects | 0 | - | - | - | - | - |
Objects Moved by Compactor | 0 | - | - | - | - | - |
Objects Not Moved by Compactor | 0 | - | - | - | - | - |
Objects Finalized | 82 | - | - | - | - | - |
Boxed Value Types | 3273 | - | - | - | - | - |
Process Heap | - | 1280 | 7484 | 198308 | 72 | 330016 |
Short Term Heap | - | 0 | 6382 | 963 | 0 | 42136 |
JIT Heap | - | 0 | 6402 | 421097 | 0 | 876976 |
App Domain Heap | - | 0 | 18679 | 324926 | 0 | 523240 |
GC Heap | - | 0 | 30 | 527974 | 0 | 1060864 |
Native Bytes Jitted | 844928 | 208 | 1963 | 430 | 84 | 9684 |
Methods Jitted | 1963 | - | - | - | - | - |
Bytes Pitched | 0 | 0 | 0 | 0 | 0 | 0 |
Methods Pitched | 0 | - | - | - | - | - |
Method Pitch Latency Time (ms) | 0 | 0 | 0 | 0 | 0 | 0 |
Exceptions Thrown | 4 | - | - | - | - | - |
Platform Invoke Calls | 0 | - | - | - | - | - |
COM Calls Using a vtable | 0 | - | - | - | - | - |
COM Calls Using IDispatch | 0 | - | - | - | - | - |
Complex Marshaling | 367 | - | - | - | - | - |
Runtime Callable Wrappers | 0 | - | - | - | - | - |
Socket Bytes Sent | 0 | - | - | - | - | - |
Socket Bytes Received | 0 | - | - | - | - | - |
Controls Created | 13 | - | - | - | - | - |
Brushes Created | 23 | - | - | - | - | - |
Pens Created | 8 | - | - | - | - | - |
Bitmaps Created | 16 | - | - | - | - | - |
Regions Created | 0 | - | - | - | - | - |
Fonts Created | 7 | - | - | - | - | - |
Graphics Created (FromImage) | 0 | - | - | - | - | - |
Graphics Created (CreateGraphics) | 0 | - | - | - | - | - |
In the next part of this series, I will talk about the .NET Compact Framework v2's JIT Compiler performance counters.
Take care,
-- DK
[Edit: post titles]
Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.
Comments
- Anonymous
August 19, 2008
PingBack from http://jajahdevblog.com/jasmine/?p=192