Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Profiling under Linux

4 views
Skip to first unread message

Ignoramus11615

unread,
Nov 5, 2009, 3:59:40 PM11/5/09
to
I have a C++ program that is slower than I would like.

I would like to use a profiler that would tell me in what functions is
it spending the most actual time.

gprof seems like an interesting tool, but I would like to know if
there are other alternatives.

The issue is that I have a particular program that is slower under
Windows than it is under Linux, and I want to know why that is the
case.

I use -O3 and g++-4.2

Thanks

James Kanze

unread,
Nov 5, 2009, 5:07:13 PM11/5/09
to
On Nov 5, 9:59 pm, Ignoramus11615 <ignoramus11...@NOSPAM.

11615.invalid> wrote:
> I have a C++ program that is slower than I would like.

> I would like to use a profiler that would tell me in what
> functions is it spending the most actual time.

> gprof seems like an interesting tool, but I would like to know
> if there are other alternatives.

Why? Does gprof has some problems that it's not providing the
information that you need?

> The issue is that I have a particular program that is slower
> under Windows than it is under Linux, and I want to know why
> that is the case.

So you want to use a profiler under Linux to find out why it is
slower under Windows. Sounds a bit strange to me. (FWIW:
Windows is significantly slower than Linux for many operations,
including file operations---anything involving reading from or
writing to disk will run slower under Windows.)

--
James Kanze

Jiří Paleček

unread,
Nov 5, 2009, 6:48:14 PM11/5/09
to
On Thu, 05 Nov 2009 21:59:40 +0100, Ignoramus11615
<ignoram...@nospam.11615.invalid> wrote:

> I have a C++ program that is slower than I would like.
>
> I would like to use a profiler that would tell me in what functions is
> it spending the most actual time.
>
> gprof seems like an interesting tool, but I would like to know if
> there are other alternatives.

There are alternatives, among others:

- oprofile, which gives coarse, but based on real performance data (taken
from the performance counters in the CPU)

- valgrind --tool=callgrind, which gives very detailed data, which are
however based on simulation

None of these require you to recompile the program.

> The issue is that I have a particular program that is slower under
> Windows than it is under Linux, and I want to know why that is the
> case.

I'm afraid profiling on Linux won't show you why it's slower on Windows.

Regards
Jiri Palecek

Jeff Schwab

unread,
Nov 5, 2009, 9:32:07 PM11/5/09
to
Ignoramus11615 wrote:
> I have a C++ program that is slower than I would like.
>
> I would like to use a profiler that would tell me in what functions is
> it spending the most actual time.
>
> gprof seems like an interesting tool, but I would like to know if
> there are other alternatives.

I've had success with oprofile. It requires root.

Ignoramus11615

unread,
Nov 5, 2009, 9:51:48 PM11/5/09
to

Sorry, I meant the Linux program is slower.

i

> Regards
> Jiri Palecek

0 new messages