Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

visual studio code analysis

Options
  • 05-06-2013 10:58pm
    #1
    Registered Users Posts: 1,466 ✭✭✭


    I'm looking for a VS addin that will give me real time analysis on how a potential function change could impact my code stability.

    I guess what im looking for is risk analysis based on how often the function under edit is used. To do this the code would call back up through potential code branches working out how often the function is used and then giving me some feedback (maybe based on % of code impacted).

    I don't think I have seen such a tool, but it must exist. Can anyone give me a steer ?


Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    The ultimate edition of VS has profiling tools built in, the other versions may not. If you compile with linux/gcc there are loads of tools available. Being limited to microsoft only limits your options.

    Alternatively, just put more effort into writing unit tests? Look into test tools like valgrind etc.


  • Registered Users Posts: 2,021 ✭✭✭Colonel Panic


    You don't mention a language but I'm assuming C/C++.

    Well there's static code analysis and there's profiling. Valgrind falls into the latter and as far as I know is not available on Windows.

    From the sounds of it, you want some sort of compile or edit time checking of functions you're editing. Isn't there a way of generating call graphs for functions in VS?


  • Registered Users Posts: 1,466 ✭✭✭Smoggy


    The language is C#, but im assuming the tool will work for all languages under Visual Studio.

    I have had a look at the tools in Visual Studio and they don't do quite what I want.

    This is how I envisage it :

    A function called GetServerDate() That is used deep down the call stack, just before data is written to the database. So it's heavily used.

    So im in this function with my size 12 boots making hand fisted changes , I would to know what % of the code is impacted by this change, this serving as a warning to me to tread more lightly than usual.

    Once I receive the % impact, after the change I would like to know some information for impact analysis. I guess this would find all functions that have a dependency on GetServerDate,but potentially all the way back up to the interface / services etc.

    So when writting up the impact analysis, I can quickly go :

    Web services impacted :

    GetClientSummary
    GetPricingModel

    Interfaces impacted :

    Client update
    Price Analyser


  • Registered Users Posts: 2,021 ✭✭✭Colonel Panic


    Hmm, I can't help you I'm afraid. I guess the call graph feature in VS is a step in the right direction but it won't tell you anything about percentages which seems to be a strange metric to try to measure to me.


  • Registered Users Posts: 1,466 ✭✭✭Smoggy


    Can you not see any benefit in knowing if a function is heavily used and could have a large potential impact ?


  • Advertisement
  • Registered Users Posts: 2,494 ✭✭✭kayos


    Ok so its not going to give you percentages but ReSharper will give you all the incoming/outgoing calls to a method etc. You could enable Test Impact Analysis in VS as well if you have a good level of unit test code coverage.

    I'd ask you though why you need a tool to tell you to be more careful. I don't care if a piece of code I'm touching is used in one place or all over the place I would still write and test my code to the same level. In other words make sure of your change no matter where it is or how heavily its used. The code your touching might only be called from two sources now but in 6 months that could be 20.


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Smoggy wrote: »
    Can you not see any benefit in knowing if a function is heavily used and could have a large potential impact ?

    The profiler tool in VS will tell you this. What version of VS do you have?


  • Registered Users Posts: 2,021 ✭✭✭Colonel Panic


    Smoggy wrote: »
    Can you not see any benefit in knowing if a function is heavily used and could have a large potential impact ?

    Of course I can, but I don't think that profiling / timing and unit tests beats the hell out of my understanding of what you describe.


  • Registered Users Posts: 1,466 ✭✭✭Smoggy


    srsly78 - vs2008 / But I have access to vs2010

    Colonel Panic - Your assuming I work in a company that has automated unit testing :) That's not the case. I live in a dangerous world of not truly knowing the full impact of a change and would like a little more details in this area.

    kayos - If I had knowledge of functional usage, I could priorities my time to spend more time testing this area.


  • Registered Users Posts: 11,262 ✭✭✭✭jester77


    I have never used VS, but could you not run some code coverage/metric tools on your CI server? There must be plenty of open source tools out there (i've done this for perl, ruby and java) that can generate reports where you can then visually trace paths.


  • Advertisement
  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Smoggy wrote: »
    srsly78 - vs2008 / But I have access to vs2010

    Colonel Panic - Your assuming I work in a company that has automated unit testing :) That's not the case. I live in a dangerous world of not truly knowing the full impact of a change and would like a little more details in this area.

    kayos - If I had knowledge of functional usage, I could priorities my time to spend more time testing this area.

    What version? Professional or ultimate? The normal pro version most people use does not have the fancy profiler/analysis tools.

    There is a corporate/msdn version too that gives you everything too I think.


  • Registered Users Posts: 1,466 ✭✭✭Smoggy


    Professional :(


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    At a simple level you can right-click any function name (or variable) and click "Find all references". That will give you a list of all the direct calls to that function. It's not a percentage obviously, but it should give you a good idea of how commonly called that function is.


Advertisement