Odd profiler results

This is a discussion on Odd profiler results within the Game Programming forums, part of the General Programming Boards category; Profiled some D3D code and found that most of the time was spent in D3DXSHProjectCubeMap which is for spherical harmonics. ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598

    Odd profiler results

    Profiled some D3D code and found that most of the time was spent in D3DXSHProjectCubeMap which is for spherical harmonics.

    After searching the entire solution I could not find a single call to this function yet 60% of runtime is devoted to this function.

    Anyone else have similar issues when profiling Direct3D code? Googled and found one forum question just like this...but had no replies.
    Last edited by VirtualAce; 04-24-2010 at 12:26 AM.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,370
    O_o

    This is probably D3DX10SHProjectCubeMap or D3DX11SHProjectCubeMap.

    I can't imagine why this is so costly for you.

    Soma

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,764
    Put a breakpoint on it, then do a backtrace to see where it came from?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    That's just it - I can't breakpoint it. It is never called in any of the code. I'm wondering if some D3DX functions are calling it internally.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,764
    So how do you know it's being called then?

    The debugger should allow you to set a breakpoint at any given address - not just source lines you can click on.

    Does your profiler know the difference between public and private symbols?

    Code:
    void foo ( ) {
      // not a lot, I don't think I call this
    }
    
    static void bar ( ) {
      // expensive function being called
    }
    Some stupid profilers will mistakenly attach all the run-time of bar() to the foo() function.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    So how do you know it's being called then?
    It's in the profiler function coverage results. I think we ran VTune and another open-source profiler and both came back with nearly the same results. Not sure if the profiler knows the difference between public and private symbols. All I can gather is that perhaps D3DX is using this function internally or one of the libs we are using is. It is very odd though b/c we have no use for this function in the system.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,764
    It's certainly strange that you can't apparently put a breakpoint on it.

    The profile results - do they give you file:line information, or is it more basic "address+offset" information?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    From what I remember of the output it appeared to give function and address + offset only. I did not see any line number information. If it is internal to D3DX I will not be able to breakpoint it since I do not have the source. I might be able to breakpoint it in assembly code to find and then walk backwards to find out the caller but that doesn't sound like that much fun.

    I must say it is the strangest profiler results I've seen so far. I would like to address the issue but I really can't until I figure out who or what is calling this function. Sorta hard to optimize code when you don't know why, who, or what is calling a function where most of the time is spent.

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,764
    In WinDbg, setting breakpoints is a matter of
    bp dllname!symbol+offset

    Another thing to look at is a map file (which also shows symbol names and addresses).
    With some luck, you might be able to figure out the extents of functions, and whether your profile results really are inside that function (or some other unnamed local).

    Also see if Microsoft have an updated symbol pack for your version of D3DX.
    That in itself might get better information from the profiler.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Very true. I didn't think of that.

    Thanks for all the help. When I find out exactly what is going on I'll be sure and share it here so that others in the future won't have to do all this to figure it out. It isn't often when Google draws a blank so I'm beginning to think my situation is an isolated specific one due to the mix of libs being utilized.

  11. #11
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,370
    Have you had any luck?

    Soma

    (I'm interested in this.)

  12. #12
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Nope.

  13. #13
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,370
    Well... good luck with it.

    Soma

  14. #14
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    The profile also revealed a 3rd party library was performing poorly. Rather than search for the source of the D3DX call I figured my time was better spent optimizing my use of the library in question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Odd results.. help?
    By MCyborg in forum C Programming
    Replies: 15
    Last Post: 11-14-2005, 07:24 PM
  2. _chdrive odd results
    By cyreon in forum Windows Programming
    Replies: 2
    Last Post: 06-23-2005, 06:35 PM
  3. Odd results for such a simple procedure.
    By tyouk in forum Windows Programming
    Replies: 2
    Last Post: 01-14-2005, 08:16 PM
  4. C Subroutine produces odd results
    By IGAU in forum C Programming
    Replies: 8
    Last Post: 11-24-2003, 09:47 AM
  5. Same seed for srand yields different results
    By codegirl in forum C++ Programming
    Replies: 3
    Last Post: 06-23-2003, 03:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21