On Wed, 21 Mar 2007, Dan Price wrote:

On Wed 21 Mar 2007 at 10:24PM, allen mathias wrote:
Apologies for not posting this earlier. This is the source code.

int main()
{
        string line;
        ofstream fsmo;
        fsmo.open("temp.temp.ae");

        ifstream fsm;
        fsm.open("temp.ae");
        getline(fsm, line);
        while(line!="eof")
        {
                fsmo << line<< endl;
                getline(fsm, line);
        }

        return 0;
}

If you run your two variants under truss -c, you may see that under CC
this seems to generate an excess of lseek's.  I'm not sure why:

This is the problem with the default C++ library, I believe.

Alexander

Here's an example from /usr/dict/words (I stuck "eof" at the end of it):

CC:

lseek                    .571  150890

write(6, " a d m o n i t i o n\n", 11)          = 11
lseek(6, 0, SEEK_CUR)                           = 2763
lseek(6, 0, SEEK_CUR)                           = 2763
lseek(6, 0, SEEK_CUR)                           = 2763
lseek(6, 0, SEEK_CUR)                           = 2763
lseek(6, 0, SEEK_END)                           = 2763
lseek(6, 2763, SEEK_SET)                        = 2763

g++:

lseek                    .000       1

write(6, " a d m o n i s h\n", 9)               = 9
write(6, " a d m o n i t i o n\n", 11)          = 11
write(6, " a d o\n", 4)                         = 4



That's not good, although I don't know why that might be happening.
Could you confirm whether you are indeed seeing this happen?

       -dp

--
Daniel Price - Solaris Kernel Engineering - [EMAIL PROTECTED] - blogs.sun.com/dp
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org


_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to