Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-03-2004, 08:08 AM   #1
LQ Newbie
Registered: Nov 2004
Posts: 1

Rep: Reputation: 0
Benchmarking an application


I want to benchmark a custom application developped in C++. The code compiles under Windows and Linux but I d rather benchmark my application under Linux. The information I want are:
- Time-related: how long it take to process a function or an executable. Real time and CPU time
- Memory related: how much memory is used by my function or my executable. The whole memory-use profile would be ideal but the maximum memory used should be the more relevant information needed.
- System-related information such as number of calls to the system

As for time, gettimeofday function seems to be the right function (I need to have a millisecond accuracy). As for the other information, I dont know which functions (or libraries) I should use.

Can anyone help me, please


Old 11-03-2004, 09:00 AM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Try using gprof - the profiler. You do not have to instrument your code to get results.
The compiler does it for you

Compile with -g and -p, run your code, then gprof <programname>

If you only need time spent:
time myprgram
Old 11-04-2004, 09:24 AM   #3
Registered: Dec 2002
Location: Russia
Distribution: ASP linux
Posts: 94

Rep: Reputation: 15
Re: Benchmarking an application

Originally posted by JAllegraud
System-related information such as number of calls to the system
strace can be used to do this. For example, strace -c can be used to "Count time, calls, and errors for each system call and report a summary on program exit". If you are developing a multi thread/process application, you may need "-f -F" keys.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Benchmarking goldfish_memory Linux - General 1 11-18-2005 12:45 PM
benchmarking HP DL380 elliottr Linux - Hardware 1 06-14-2005 07:32 AM
benchmarking softwareI Moebius Linux - Software 4 01-26-2004 07:14 AM
benchmarking linux new_linux_goof Linux - General 0 05-14-2002 08:59 PM
Stress benchmarking linear Linux - General 0 01-13-2002 01:44 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration