473,692 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

any classes help me to measure some program segment runing time.

Hi,

For example, there is a function which is called many times from
different places in a program. I want measure how long this function
runs in total.

Of course, I can use gettimeofday to measure its running time. But it
looks a little cumbersome. I'm wondering whether there is a class for
it. Thanks!

Best wishes,
Peng
Jul 23 '05 #1
7 1292
"Peng Yu" <pe*******@gmai l.com> wrote...
For example, there is a function which is called many times from
different places in a program. I want measure how long this function
runs in total.

Of course, I can use gettimeofday to measure its running time. But it
looks a little cumbersome. I'm wondering whether there is a class for
it. Thanks!


There is no class for it. There are tools for that. Called "profilers" .

V
Jul 23 '05 #2
Could you give me a pointer of the better profiler that you think?
Thanks!

Peng

On Sun, 6 Mar 2005 14:55:49 -0500, "Victor Bazarov"
<v.********@com Acast.net> wrote:
"Peng Yu" <pe*******@gmai l.com> wrote...
For example, there is a function which is called many times from
different places in a program. I want measure how long this function
runs in total.

Of course, I can use gettimeofday to measure its running time. But it
looks a little cumbersome. I'm wondering whether there is a class for
it. Thanks!


There is no class for it. There are tools for that. Called "profilers" .

V


Jul 23 '05 #3
Try gprof

Peng Yu wrote:
Could you give me a pointer of the better profiler that you think?
Thanks!

Peng

On Sun, 6 Mar 2005 14:55:49 -0500, "Victor Bazarov"
<v.********@com Acast.net> wrote:
"Peng Yu" <pe*******@gmai l.com> wrote...
For example, there is a function which is called many times from
different places in a program. I want measure how long this function runs in total.

Of course, I can use gettimeofday to measure its running time. But it looks a little cumbersome. I'm wondering whether there is a class for it. Thanks!


There is no class for it. There are tools for that. Called "profilers" .
V


Jul 23 '05 #4
Peng Yu wrote:
Could you give me a pointer of the better profiler that you think?


Please don't top-post. Thanks.

Try Intel's vTune, it's pretty good and exists on several platforms.
However, this is still very platform-specific, so please make all
your tool inquiries in a newsgroup dedicated to your platform.

V
Jul 23 '05 #5
On Mon, 07 Mar 2005 10:35:21 -0500, Victor Bazarov
<v.********@com Acast.net> wrote:
Peng Yu wrote:
Could you give me a pointer of the better profiler that you think?


Please don't top-post. Thanks.

Try Intel's vTune, it's pretty good and exists on several platforms.
However, this is still very platform-specific, so please make all
your tool inquiries in a newsgroup dedicated to your platform.

V

By "top-post", do you mean that I should put the reply under the
original message like this.

Is it a general courtesy fot newsgroup? Cause I use the reverse way to
reply email.

Thanks,
Peng
Jul 23 '05 #6
"Peng Yu" <pe*******@gmai l.com> wrote...
[..]
By "top-post", do you mean that I should put the reply under the
original message like this.
It would be appreciated, yes.
Is it a general courtesy fot newsgroup?
Yes. It promotes readability.
Cause I use the reverse way to
reply email.


I don't.

Microsoft tools spread bad habits around the world. Just for that
the designers of their software should be hung, shot, and drowned.

V
Jul 23 '05 #7
Peng Yu wrote:
For example, there is a function which is called many times from
different places in a program. I want measure how long this function
runs in total.


i would use a profiler to do what you are describing. profilers can give you
the time spent on each function regardless of where it was called from.

since profilers are rather specific to the compiler/platform you use, it's a
worthless exercise to give generic advice. i use gcc on GNU/Linux systems
and use gprof for profiling (callgrind is also a nice alternative). i have
no idea of comparable tools in other platforms as i have not seriously used
other platforms for development in a long time.

if you do use GNU/Linux (or gcc on any platform), email me directly and i
can give you pointers if you need.

anoop aryal

Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
1793
by: D Witherspoon | last post by:
What is the accepted method of creating a data class or business rules object class with properties that will allow the returning of null values? For example... I have a class named CResults with the following properties. TestID int QuestionID int AnswerID int So, this is a simple example, but I want to be able to know if AnswerID is
45
3601
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes themselves are an exception to this), and 'bootstrap' your program by instantiating a single application object in main(), would that place any limitations on what you could accomplish with your program? Are there any benefits to doing things that...
6
61817
by: Charles M. Reinke | last post by:
I'm using the function clock() to measure the run time of a program so that I can compare among several different algorithms. My code looks like: #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <time.h> int main() { clock_t start, stop;
65
12579
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second method was a piece of C code which turned out to be incorrect and incomplete but by modifieing it would still be usuable. The first method was this piece of text:
0
877
by: Borf | last post by:
I have 2 fact tables, 1 contains volume of goods sold, and a month key. Each record is for a different store location. The second fact table contains the number of business days in a month, and the month key. Now I want to produce a report to show number of business days and the volume for that month. However runing a report returned all NBD records even If there was no volume for that month. So I created a calculated measure to return the...
19
1825
by: dl | last post by:
I'll try to clarify the cryptic subject line. Let's say I have a base class 'GeometricObject' with a virtual method 'double distance (const GeometricObject &) const'. Among the derived classes I have eg 'Segment', representing a segment of a line, and 'Arc', representing an arc of circle. What is the right place to put the code for computing the distance between a Segment and an Arc? It is not specific to the Segment nor to
29
2770
by: Dom | last post by:
I'm really confused by the difference between a Struct and a Class? Sometimes, I want just a group of fields to go together. A Class without methods seems wrong, in that it carries too much overhead (I think). A Struct seems more appropriate. At least it is what I would have used in other languages. But since a Struct *can* hold methods, I wander if I am saving anything. If not, why use it?
0
734
by: PanchalRakesh | last post by:
Dear All, I am Developing a window service in which i am continously check which program runing currently in my computer memory for how many time , in which memory address and when it start and end all the things about that program I am Using VB.Net For This Win Service Can Any One Help Where I Start Rakesh Panhal
0
8608
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9086
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8806
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6459
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2241
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1959
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.