CodeTrack: Deeptrace rulesets
In this section you'll find out all about rulesets:
What are rulesets ?
A ruleset defines what should be deeptraced (see
Profiling modes). A ruleset consists of 2 parts:
Methods: A set of rules that define which methods should have their start and stop time traced. For each of these rules you
can also specify if you want to trace arguments. If you enable 'Trace All Children' all calls
that happen during this method (in the same thread) will also have their start and stop time
traced. Depending on the left argument of the rule you can also enable 'Trace derived', this
means also derived methods will be traced. This way you can just specify a method on a base
class and all same methods on derived classes will also be deeptraced.
Fields: A set of rules that define which fields need to be traced when their parent object is traced as an instance, argument
or returnvalue of a deeptraced method call.
Purpose of rulesets
Rulesets can be used with different goals in mind, these are the most important ones:
Understanding code execution
The most obvious reason is to know why your code flows in a certain way. You could for instance
trace all methods of your own namespace(s). Afterwards in your trace you can then see the
exact sequence of all their methodcalls (which is not guaranteed to be correct in regular
tracing mode) and maybe even their arguments to understand why a certain flow was executed.
Plugin data source
Some plugins need to have a very specific set of methods and or fields deeptraced. A simple
example is the console plugin: this shows all output that has been written to the console
window. For this to work we need for instance all System.Console.WriteLine methods traced
with their arguments. Plugins can embed one or more rulesets as a resource and these will
automatically be added to your library. Once you do a deeptrace with such a ruleset enabled,
the corresponding plugin will also be enabled in the analyze view.
Providing landmarks for navigating
It might sometimes be handy to deeptrace certain methods just to use them as a landmark.
You can then easily use these methods to navigate around the timeline and maybe rescope to
a particular moment in time. You could for instance deeptrace all methods on types that inherit
from System.Web.Mvc.ControllerBase, to later rescope to a particular webrequest.
Creating new rulesets
There are 2 places where you can create a new ruleset: In the options of a trace configured as DeepTrace, or in the Deeptrace
library under the Settings tab. Both work exactly the same, although there is 1 important difference:
rulesets that are created in a trace configuration are only present in that trace configuration and
not in later tracing sessions (unless you promote it to the library by clicking on the book icon
Rulesets created in (or promoted to) the library will be available to use in all subsequent trace
You create a new ruleset by clicking the add button (
). After that you can specify a title and a description for your ruleset. You can also select
a category, or type a new category if none fits your need.
The 'Active' checkbox specifies if the ruleset will be enabled by default in new traces.
After that you can just start adding method and field rules in the corresponding tabs. After you
select the left argument (specifying the property on which to include a method), you can type the
right argument, but also use the picker (
) to easily specify it. Select the assembly to use as a source for browsing and then select
one or more items. You can use the filterbox to help you find the right items.
If you specify more then 1 item, additional rules will be automatically created.
To start from an existing ruleset to create a new one, first copy the existing rulest and then,
after creating a new ruleset, paste it. You can now change the copy to your liking.
By default CodeTrack comes with a set of preloaded rulesets. Once you start editing or adding rulesets you are creating your
own library. At any time you can export your library to a file to backup your library or to share it
with othe codetrack users. Importing a library is just as easy, just keep in mind that importing a library
will completely overwrite your current one (so in some cases you might want to backup first).
By clicking the reset command you revert the library to the Codetrack default (and thus also overwriting
the current library).
Default rulesets and rulesets provided by plugins can not have their rules changed (that might break
some plugins because of some dependencies). You can however add extra rules to these rulesets if you
wish. Or you could create a copy of the ruleset and then edit it.
As mentioned in
Ruleset Library, rulesets are designed to be easily shared with other Codetrack users. On top
of sharing your creations yourself, by default Codetrack also sends them to a server. This way your
ruleset or a part of it might be added to the default library in future releases to help others.
If for some reason you don't want this, you can easily disable this in the Settings tab under 'Data