Dotnet Performance Counter : CLR Security

In this article we are going to know about performance counters related to CLR security. That means, measuring performance overhead for CLR security checks for an application.

CLR has different security checks before execute an application. These are main counters.


% Time in RT checks : Time % spend on access checking since last collected sample.
>Update after each checking.

This is very important performance counter due to nature. It might be overhead for performance.

Stack Walk Depth : Depth (in number) at last runtime code access security check by walking the stack. This indicates complexity.

Total Runtime Checks : Total number of performed runtime code access security checks since the application started.
>Runtime checks are done when a caller ask for a permission at current thread stack of caller.

Note : With high Stack Walk Depth value,  this counter indicates the performance penalty due to security checks. So, this two together becomes important performance counter.

Number of Link Time Checks: Total number of Link Time code access security checks since the app started.
>Link time checks due to caller demands for permission at JIT compile time. So, it is once per caller.
>Due to this behavior, it is ignored while performance measurement but measure only for security purposes.

Thanks.. :)