By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,434 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,434 IT Pros & Developers. It's quick & easy.

performance of c++ programm

P: n/a
CQ
Hi ya all!

I would like to check the performance of my c++ programm. That is, I
would like to find out which functions are the most time consuming
ones, for instance. Then I would like to figure out if the program has
some memory leaks.

Well, I have heard that there is a way to do that. But I have no idea
how it goes.
Can anyone help me on that?
Thanks a lot in advance,

CQ.

Nov 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
* CQ:

I would like to check the performance of my c++ programm. That is, I
would like to find out which functions are the most time consuming
ones, for instance.
Check out profiler tools (note that tool usage is generally OT here).

Then I would like to figure out if the program has some memory leaks.
That would be a good idea to check first. But instead of making a mess
and then try to tidy it up, it's generally better (much less work, much
better chance at acceptable result) to be orderly in the first place.
In C++, for this particular issue, it generally means using smart
pointers and standard library container classes, instead of raw
pointers, raw arrays and DIY containers.

Well, I have heard that there is a way to do that. But I have no idea
how it goes.

Can anyone help me on that?


See above.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 22 '05 #2

P: n/a
CQ wrote:
Hi ya all!

I would like to check the performance of my c++ programm. That is, I
would like to find out which functions are the most time consuming
ones, for instance. Then I would like to figure out if the program has
some memory leaks.

Well, I have heard that there is a way to do that. But I have no idea
how it goes.


For both, there are pwerful development tools. The time measurement is done
by a profiler. Memory leaks can be found with a memory debugger. If you are
developing for linux, have a look at valgrind, which is free and can do
both.

Nov 23 '05 #3

P: n/a
CQ wrote:
[snips]
I would like to check the performance of my c++ programm. That is, I
would like to find out which functions are the most time consuming
ones, for instance. Then I would like to figure out if the program has
some memory leaks.


As others have said, there are various commercial profiler tools.

A limited form of memory leak detection is standard on some
development platforms.

As to profiling: The basic idea is, the tool will "instrument" your
code. That is, it will insert extra lines of code that do things
like marking the call to and return from various functions, and
things like that. You can "roll your own" to get some idea of
the time your code spends in various activities. For example,
at a very simple level you could use the system command
and grab your operating system's time before you start a task
and after you finish. This will be not nearly as sophisticated
as a commercial product.
Socks

Nov 23 '05 #4

P: n/a

"CQ" <su*******@gmx.net> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I would like to check the performance of my c++ programm. That is, I
would like to find out which functions are the most time consuming
ones, for instance. Then I would like to figure out if the program has
some memory leaks.

Well, I have heard that there is a way to do that. But I have no idea
how it goes.


This should get you started: www.digitalmars.com/techtips/timing_code.html

-Walter Bright
www.digitalmars.com C, C++, D programming language compilers
Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.