I've used clang's -ftime-trace option in the past and that's also really good. It's a pity gcc has nothing similar.