Results 1 to 3 of 3

Thread: using profiler to measure performance of 2 functions

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    using profiler to measure performance of 2 functions

    Hello,

    VS 2008 Development Edition.

    I have 2 functions that do the same thing but using a different technique. I want to test the performance of these functions to see which one is more efficient and performs faster.

    However, when I use the performance wizard I can never see my functions being analyzed.

    Code:
    private void Function1()
    {
    string callStatus = "<sip:[email protected]:5060>";
    string result = Regex.Match(callStatus, "(?<=\\<sip:)[a-z]+(?=@)").ToString();
    }
    
    private void Function2()
    {
    string callStatus = "<sip:[email protected]:5060>"; 
    string usernameAndIP = callStatus.Remove(0, 5);
    string[] username = usernameAndIP.Split('@');
    string result = username[0].ToString(); 
    }
    I launch the performance wizard and select sampling.

    I launch with profiling and I run my application. I then click stop the profiling and review the report.

    On the summary I have "functions doing most work", and "functions causing most work". However, I don't see my functions 1 and 2 listed.

    I use the drop down list box and select functions, my functions are still not there.

    However, I look at the code metrics then I can see my functions, and can review information like maintainablity, lines of code, etc.

    I would like to test this functions for speed and efficiency, and not sure what it the best way to do that?

    Also, I thought Development edition was surpossed to give analysis on code that is not very efficient and give information on how to modify to make it more efficient? I guess I am just new at doing this profiling technique.

    Many thanks for any information that can help me solve my above problems,
    steve

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: using profiler to measure performance of 2 functions

    I've never used that wizard so I can't comment there, but couldn't you just use a Stopwatch to time your two methods? It won't teach you how to use the profiling tools but for this specific task it's easier.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Re: using profiler to measure performance of 2 functions

    Hello,

    I did think about using the stopwatch. However, as I have invested in the development edition, I would really like to use the profiler. I guess I will have to go back to the documentation.

    Steve
    steve

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