Thread: Gprof under windows

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    147

    Gprof under windows

    Hi,
    I am using CodeBlocks/MinGW for windows and I am getting problems to run the profile tool (gprof). I have turned on the -pg switch in compiler option, then compile and open a ms-dos windows. Then write in the correct directory gprof main.c , get a "not in executable file fomat" error.
    How can I get it to work? I'm looking at internet but no detailed help is provided for these steps .....
    thx in advance

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    396
    gprof expects the executable name as argument, not the source file name.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    147
    Hi, thanks, I have just get it to work. Only that it is not what I expected. With this feature I see how many time a instruction have been executed. Is there any way I can see how much time functions takes?
    thx in advance

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    396
    I'm not sure about the windows' version but you should have a column indicating the % of time spent in a function, as described here:

    http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    147
    I get it to work, but in the listing the result for all funtions in the time column appear to 0%. any idea why?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    How long is the runtime of your app?

    I got this:
    Code:
    Each sample counts as 0.01 seconds.
      %   cumulative   self              self     total
     time   seconds   seconds    calls  ns/call  ns/call  name
    100.00      0.03     0.03   990000    30.30    30.30  decodeDigit(char, int*)
      0.00      0.03     0.00    99000     0.00   303.03  checkISBN(char*)

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    147
    I have running my app for around one minute.
    I use recursive functions, I dont know if that is a problem.....

  8. #8
    Registered User
    Join Date
    Feb 2008
    Posts
    147
    Quote Originally Posted by Kempelen View Post
    I have running my app for around one minute.
    I use recursive functions, I dont know if that is a problem.....
    oppppssssss!!!!, I have just discovered why it happen. My app is a multithread application. gprof does not support that kind of executables (
    bad luck

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:16 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM