I want to know how we can calculate the time taken for the compilation of a program...pls help..
15 4323 Ganon11 3,652
Recognized Expert Specialist sicarie 4,677
Recognized Expert Moderator Specialist
Check out this function.
You know how to tell when you're too tired to be at work? You look at the URL and think, "What the hell is the C Lock function?" And realize only by noticing 'ctime' that it's "clock".
Okay, let's see if I can get away with sleeping in my cube.
Check out this function.
Actually i want to know the compilation time of a c++ program...could u pls tell me how can i use the function clock....
Actually i want to know the compilation time of a c++ program...could u pls tell me how can i use the function clock....
Some compilers are kind enough to tell you such details or maybe you are writing a C++ compiler using C++?
Some compilers are kind enough to tell you such details or maybe you are writing a C++ compiler using C++?
Ya I am writing a C++ program...and i tried the below program
#include<time.h>
#include<stdio.h>
#include<dos.h>
int main(void)
{
clock_t start , end;
start=clock();
delay(2000);
end= clock();
printf("the time was: %f \n",(end-start/CLK_TCK_;
return 0;
}
but this doesnt give the proper time..its giving the time after i press RUN..
Banfa 9,065
Recognized Expert Moderator Expert
What's your interest in knowing the compilation/link time?
The only times when it has ever been an issue in my carrier it has been acceptable to time it by hand using a trust wrist watch and just noting the approximate start and end times, i.e. normally people only care when the time is long enough to measure inaccurately with knowing the exact start and stop times.
Ya I am writing a C++ program...and i tried the below program
#include<time.h>
#include<stdio.h>
#include<dos.h>
int main(void)
{
clock_t start , end;
start=clock();
delay(2000);
end= clock();
printf("the time was: %f \n",(end-start/CLK_TCK_;
return 0;
}
but this doesnt give the proper time..its giving the time after i press RUN..
1.) Use code tags when posting code
2.) That won't give you compilation time. Compilation time by the way will be different on different compilers and platforms. You need to give a C++ source file as an argument to a compiler that you have access to so that you then measure the start and stop time of the compilation process that you will have manually started.
What's your interest in knowing the compilation/link time?
The only times when it has ever been an issue in my carrier it has been acceptable to time it by hand using a trust wrist watch and just noting the approximate start and end times, i.e. normally people only care when the time is long enough to measure inaccurately with knowing the exact start and stop times.
My interest is that..I hav 2 C++ programs....and I want to know which one will take less time...and choose the best between the two...and the time is in milli seconds..which cannot b noted using a wrist watch..
What's your interest in knowing the compilation/link time?
The only times when it has ever been an issue in my carrier it has been acceptable to time it by hand using a trust wrist watch and just noting the approximate start and end times, i.e. normally people only care when the time is long enough to measure inaccurately with knowing the exact start and stop times.
Only use I can think of it is when one is making a C++ compiler wants to test their compiler's compilation speed.
I'm of the opinion that writing a C++ compiler is actually useless in itself so there.
Banfa 9,065
Recognized Expert Moderator Expert
I'm of the opinion that writing a C++ compiler is actually useless in itself so there.
That rather depends on if you are manufacturing a new processor or not. If you are creating a new processor then not creating a compiler for it is going to somewhat limit it's use :D
My interest is that..I hav 2 C++ programs....and I want to know which one will take less time...and choose the best between the two...and the time is in milli seconds..which cannot b noted using a wrist watch..
Take a deep breadth.
Now read this:
Compilation time is different from running time.
A fast program is not a program that takes a short time to compile. It is one that takes a short time to run.
That rather depends on if you are manufacturing a new processor or not. If you are creating a new processor then not creating a compiler for it is going to somewhat limit it's use :D
Thankfully I don't fiddle around with such stuff anymore.
Of course creating a processor is not entirely useless so I take back half of my ealier remark.
Banfa 9,065
Recognized Expert Moderator Expert
A fast program is not a program that takes a short time to compile. It is one that takes a short time to run.
Actually almost certainly the reverse, optimisation takes far longer than actual compilation of the code so if you where to switch off the optimisation in your compiler you will almost certainly end up with a program that compiles faster.
However optimised code almost always runs faster than un-optimised code so if you switch off the optimiser you will almost certainly end up with a program that runs slower.
Actually almost certainly the reverse, optimisation takes far longer than actual compilation of the code so if you where to switch off the optimisation in your compiler you will almost certainly end up with a program that compiles faster.
However optimised code almost always runs faster than un-optimised code so if you switch off the optimiser you will almost certainly end up with a program that runs slower.
So how is my comment the reverse of this?
Banfa 9,065
Recognized Expert Moderator Expert
So how is my comment the reverse of this?
Sorry I meant your statement did not go far enough, a short compile time is likely to mean a long run time and vice versa.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Charles Law |
last post by:
Hi guys
I have a time critical process, running on a worker thread. By "time
critical", I mean that certain parts of the process must be completed in a
specific time frame. The time when the...
|
by: Christine |
last post by:
I've implemented a countdown timer for a tutorial web page that should
give the user 45 minutes to complete the test, only to find that the
timer is slowly 'losing' time. On average, it actually...
|
by: Francesc Guim Bernat |
last post by:
Dear colleagues,
i'm getting in troubles using one XML library with Visual Studio .NET
and Xerces with Xalan.
When i execute the code i get the next run time error:
"Run-Time Check Failure #2...
|
by: Peter Row |
last post by:
Hi,
I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest.
This code calls a sub and I need to know if that sub did a response redirect
or not.
Specifically I need to know...
|
by: silversurfer2025 |
last post by:
Hello everyone,
once again, I have a very basic problem in C++, which I was not able to
solve (maybe because of my Java-Experience or just because it is always
the small syntax-things which break...
| |
by: Matik |
last post by:
Hi,
I have a funny situation.
Within: MSSQL 2000 SP3, everything below described is running on same
PC.
there is a program running, which sends information to two other
programs.
This...
|
by: =?Utf-8?B?Q2hha3JhdmFydGh5?= |
last post by:
Today, after watching the presentation by Amanda Silver at
http://channel9.msdn.com/Showpost.aspx?postid=335058 , from Channel 9,
started exploring the LINQ features. Surprisingly, few facts...
|
by: Analizer1 |
last post by:
Hello all
I have a idea...and dont know if it is possible......
we have a pretty huge system at work and
we send EDI Special formatted Data to Several
Other Companies, via sFtp,dial up, vpn...
|
by: devnew |
last post by:
hi
i am trying to create a cache of digitized values of around 100
image files in a folder..In my program i would like to know from time
to time if a new image has been added or removed from the...
|
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,...
|
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...
| |
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: 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...
|
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: 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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
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 ...
| |
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...
| |