473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

performance of c++ programm

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
4 1269
* 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
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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Atz | last post by:
Hi to all ! 1.) Is there a way to make exe file from java class file ? 2.) I want to make multiple uninstalation of some files, under windows. E.g. instead of going into control panel ,...
7
by: broebel | last post by:
hey, for the real programmers amongst you, this may be really annoying but I've been learning the language for only two days. this is my problem, in this programm,which already works I now...
11
by: Michael Bader | last post by:
Hi, I'm currently working on a matrix multiplication code (matrix times matrix), and have come along some interesting/confusing results concerning the running time of the (apparently) same...
1
by: Shuo | last post by:
hi all! i´ve written a programm to swap sum files from a tcp/ip connection.now i havte to optimize the performance. but first i want to do some load tests. how can i log the process...
7
by: Michael Beumers | last post by:
Hello NG I've defined a cursor like the following in my COBOL Programm: DECLARE testc CURSOR FOR SELECT ... FROM ... WHERE field1 LIKE :hostvariable1 field2 LIKE :hostvariable2
6
by: TIM | last post by:
for example i have one simple programm int main() { int test = NULL; while(1){ printf("%d\n",test); getch(); test++; }
13
by: Andrew Au \(Newsgroup\) | last post by:
Hi all, I am switching from Java to C solely for performance, but I wonder are there any coding techniques that can boost performance in C? I am asking such an open-ended question to elicit...
83
by: deppy_3 | last post by:
Hi.I am started learning Programm language C before some time.I am trying to make a programm about a very simple "sell shop".This programm hasn't got any compile problem but when i run it i face...
2
by: LordChaos | last post by:
Dear all, I am a newbie in Java, I got the following problem: I am going through a list of directories. The programm looks inside each directory for specific files and writes them in an...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.