oes anyone know a way to plot how a watched variable changes over time in Visual Studio 2010? I.e. if you had the following code
double someVariable;
for ( int i = 0; i < 20; i++)
{
someVariable = Math.Pi() * i;
}
and you watched 'someVariable' in the ide you could step through the code and watch how it grows with each step. I would like to be able to run through the loop and plot what that variable did with out having to manually step through it. I am doing a lot of math and sometimes watching how variables change is really useful and insightful.
More info: I have a bunch of slightly different solvers and depending on the problem I am troubleshooting I would like to watch different variables to see where the problems are occurring. I currently put log these variables to a log file but it slows down the solver significantly and I have to spend a decent amount of time changing debug code to track down problems. I am looking for a slicker way to do this that is IDE centric. Sort of a Visualizer on steroids.
How about using Tracepoints? In VS 2008 (it's somewhat different in VS 2010) you just add a normal breakpoint, then right-click on it, then select "When Hit...".
In the subsequent dialog box, check "Print a message" and enter something like
someVariable = {someVariable}
This will just output its value to the output window in the IDE.
Screenshot:
Easy way? None.
But you can code it yourself..
Edit: If you dont want to create property, you can create some kind of generic class, that will have this property and has some kind of internal logging logic.
Use Perfmon and publish that value to a counter that perfmon can read. Perfmon does all the plotting etc. You just need to publish to perfmon. Unfrotunately it is not very well documented and is not trivial. (well, at least it wasn't trivial for unmanaged c++ when I was looking into it)
I did this a while back and used some classes published in an old MSJ article. (ca 1998 or so)
I will try to find some online docs.
See this question for some links
This may also be useful
If you find a solution or this works for you please let us know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With