gprof skips std::ofstream methods

Nathan Ridge zeratul976@hotmail.com
Sun Apr 25 00:52:00 GMT 2010


Hello,
 
I'm new to gprof so sorry if this is a basic question.
 
gprof does not seem to include std::ofstream methods when profiling.
 
Consider the following program in test.cpp:
 
#include <fstream>
using namespace std;
int main()
{
    unsigned long data = 1;
    ofstream fout("test.txt", ios_base::out | ios_base::binary);
    fout.write(reinterpret_cast<const char*>(&data), sizeof(data));
    fout.close();
}

I then compile like this: g++ -pg -otest test.cpp
and run gprof like this: gprof test
 
The only function that appears in the profiling results is
 
std::operator|(std::_Ios_Openmode, std::_Ios_Openmode)
 
Neither of ofstream::ofstream(), ofstream::write(), or ofstream::close()
appear. Am I missing some options perhaps that would make these appear?
 
Many thanks,
Nate. 		 	   		  
_________________________________________________________________
Hotmail & Messenger are available on your phone. Try now.
http://go.microsoft.com/?linkid=9724461



More information about the Binutils mailing list