IntelliTrace Part 2 - Data Collection

3/06/2012

So lets get back to IntelliTrace.  We are going to start out and see what it can do for us.

I talked a bit in Part 1 about what IntelliTrace was, so go check that out if you are unsure.

At an extremely high level, IntelliTrace works by collecting debugger state information during execution and saving it to a file.  We will get into more of the detail later but that is enough to get us started.  The data in this file can then be used to ‘replay’ the debugging session, step forwards and backwards and examine various information.

What does IntelliTrace collect

It’s important to understand from the beginning that IntelliTrace will not capture everything.  The product group have had to balance performance considerations with the amount of data collected.  So if you are expecting a full fidelity debugging experience with no performance loss you are going to be disappointed.

That said, the data that is collected is configurable and is tremendously useful.  There are 3 main options around data collection.

IntelliTrace Events – This is on by default.  Microsoft have defined 150ish events.  This is instrumentation that they have added to the product.  By default not every event is turned on for capture but the most common are enabled.  To see this list you can go to Tools –> Options –> IntelliTrace and select Diagnostic Events.

So what gets captured at these events.  Well, we will dig into more details later, but the short answer is “a small amount of data that is custom tuned to be relevant to the specific event being examined.”  If you try and navigate backwards to see what happened exactly before that event you probably will see the IntelliTrace data not captured message.  This is IntelliTrace saying – “sorry didn’t capture that.”
Later in this series we will see how this event data collection is configured.  An example of this is opening a file.  The file name is collected.

Calls Mode

When Calls Mode is turned on expect a performance hit.  We are now instrumenting much more data and so this will come at a cost. 

Calls mode instruments the entry and exit calls of every method in your code, including their parameters.  Note that this is in addition to any collection based on IntelliTrace events.  So you can expect to be able to see exactly which of your functions were hit, as well as what data was passed into them and what data they returned.

This collection works for one level of indirection for objects passed to/from the function.  So you won’t get all the data for deep nested objects.

Debugger Break Points

If you had any break points set when you ran the application then these are also recognised by IntelliTrace and have special collection behaviour.  At breakpoints IntelliTrace will collect local variable values and basic data types one level from objects (as with calls mode.)  So at these lines you can open the locals window and see values!   Breakpoints create a special type of IntelliTrace event called a debugger event (more on this later)

Choosing a Collection Option

So now we know what our options are, how do we select an appropriate collection level.  Go to Tools –> Options –> IntelliTrace

image

You will see that by default, IntelliTrace is enabled and the collection level is IntelliTrace events only.  In this dialog we can select Events and Call Information (Calls mode)

Obviously we can place a breakpoint anywhere in our code.  Each breakpoint will enable local variable collection.

Where is the data stored?

This has changed in SP1.  Previously, the default was to write to a folder on your drive.  Now this is turned off by default.  So once you have SP1, IntelliTrace will not capture files on your drive by default.  To check your setting choose Advanced from the Tools – > Options –> IntelliTrace menu.  Here is the default on my machine

SNAGHTML40e959f

You can see from here that the file collection is turned off.  If we do enable writing files then from this dialog we can also limit the amount of space that these files should take up.

So do I need to turn this on in order to use IntelliTrace – no!  The new default behaviour will capture the IntelliTrace information temporarily whilst you are in a VS session.  At any point in that session you can decide that you want to persist the IntelliTrace file in order to return to it later, but the default is to delete the information.  We will cover this later in the series.

So that about wraps up our default collection options.  We now have an overview of what IntelliTrace is and how we can choose different collection options.  Next time we will start collecting some data!

3/06/2012

1 comment :

  1. I like this post. this post very important. we can get lot of information thought this post and this site.

    Thanks for giving these information, good luck...!!!!

    Informatics Outsourcing - Market Research Data Collection Services

    ReplyDelete