473,396 Members | 1,712 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,396 software developers and data experts.

time the code

hi ,
i need to calculate the actual running time of my code .
that is i don't want the time wen my application is swapped out of the memory to show up in the time of the program,which actually happens wen i use the following :
Expand|Select|Wrap|Line Numbers
  1. time_t initialtime;
  2. time_t finaltime;
  3. (void)time(&initialtime);
  4.  
  5. //do something 
  6.  
  7. (void)time(&finaltime);//end of the time
  8.  
  9. int time_taken  = finaltime - initialtime;
  10.  
  11.  
please let me know if there is any other way to time the program,so the constraint i have specified is taken care of.
thanks in advance.
Jun 3 '08 #1
4 1516
gpraghuram
1,275 Expert 1GB
hi ,
i need to calculate the actual running time of my code .
that is i don't want the time wen my application is swapped out of the memory to show up in the time of the program,which actually happens wen i use the following :
Expand|Select|Wrap|Line Numbers
  1. time_t initialtime;
  2. time_t finaltime;
  3. (void)time(&initialtime);
  4.  
  5. //do something 
  6.  
  7. (void)time(&finaltime);//end of the time
  8.  
  9. int time_taken  = finaltime - initialtime;
  10.  
  11.  
please let me know if there is any other way to time the program,so the constraint i have specified is taken care of.
thanks in advance.

Try using time <your executable> from command promt if u are running this in Unix.
I hope this will give the required info

raghu
Jun 3 '08 #2
varnie
6
you can use, for example, Boost Timer Library. more info here:
http://www.boost.org/doc/libs/1_35_0/libs/timer/timer.htm
Jun 28 '08 #3
Try using time <your executable> from command promt if u are running this in Unix.
I hope this will give the required info

raghu
thanks,i will try it.
Jul 4 '08 #4
you can use, for example, Boost Timer Library. more info here:
http://www.boost.org/doc/libs/1_35_0/libs/timer/timer.htm
thanks for the info :)
Jul 4 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: newbiecpp | last post by:
I have hard time to understand run-time environment. Let assume that I have a program that has a simple variable alpha. When this variable is statically allocated, the compiler can use the...
6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
0
by: Edward Diener | last post by:
In Borland's VCL it was possible to divide a component into design time and run time DLLs. The design time DLL would only be necessary when the programmer was setting a component's properties or...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
1
by: OleMacGeezer | last post by:
Hello Everyone, I am a brand new Python programmer with barely a month of experience under my belt. Here are my specs: Mac OSX Panther 10.3.9 Jython 2.1 implementation with Hermes BBS...
5
by: chaos | last post by:
Hi , I stuck in my project as i face a problem How to show the available time of the venue when i select the day?? Need to connect to the database to find out the available time of the venue on...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
15
by: student4lifer | last post by:
Hello, I have 2 time fields dynamically generated in format "m/d/y H:m". Could someone show me a good function to calculate the time interval difference in minutes? I played with strtotime() but...
0
amitpatel66
by: amitpatel66 | last post by:
Hi All, Find below some useful information about Time Zone Conversion in oracle. Hope this would be helpful for many of them since all the real time projects that we work in follow different time...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.