CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Hybrid View

  1. #1
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Is there any way to compare two runs of a program?

    I have a program that's producing slightly different outputs on every run. I don't know why---it doesn't use randomization. It is multithreaded, but there's no sign of a bug there (no crashes or anything), and I have it set to only use 1 thread right now and it's still producing (slightly) varying outputs.

    Is there any tool which can step through two runs of the program side-by-side using the same inputs, and stop when something different happens?

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Is there any way to compare two runs of a program?

    I don't actually now. But VS 2010 Team System contains a historical debugger that records the execution path so that you can see what happens at any time. I don't know too many details yet. Maybe it's possible that you run your program on the beta 1.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Is there any way to compare two runs of a program?

    You could run two instances of the debugger and debug them at the same time.

    You could also put TRACE statements in the code to record what it's doing and compare the outputs from the TRACE statements.

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Is there any way to compare two runs of a program?

    Well obviously there's that. I was referring to something that wouldn't take forever.

  5. #5
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Is there any way to compare two runs of a program?

    Sigh...found the problem.

    Rule #1: Never assume you're only running one thread.
    Rule #2: Never forget rule #1.

  6. #6
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    1,342

    Re: Is there any way to compare two runs of a program?

    Quote Originally Posted by Lindley View Post
    Sigh...found the problem.

    Rule #1: Never assume you're only running one thread.
    Rule #2: Never forget rule #1.
    I like to check the 'thread count' column of my process in Windows Task Manager to be sure
    Old Unix programmers never die, they just mv to /dev/null

  7. #7
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: Is there any way to compare two runs of a program?

    What actually cause the problem ?
    Thanks for your help.

  8. #8
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Is there any way to compare two runs of a program?

    I had an array of parameters to my algorithm. Half my brain figured, "Hey, these are constant, I can share them between threads."

    The other half said, "Hey, I'm passing this array all around the algorithm anyway, let's use it for some temporary storage!"

    There was a lack of communication between the two.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured