|
-
May 7th, 1999, 01:13 AM
#1
program timing?
Hi, i have written a time-critical program in c++, and now i want to measure
how much time is taken by the cpu to run that program. I use visual c++ on win95/NT. i tried with the profiler available in vc++6, but it only gives the elapsed time. i want how much time cpu spent processing the program, (some things like "time" command in unix).
does anybody know of any program like "time on unix", on win95/NT.
Santosh Cheler
-
May 7th, 1999, 01:30 AM
#2
Re: program timing?
Hmmm, I'm not sure, but try the clock functions available..something like this:
#include <time.h>
clock_t begin;
clock_t end;
begin = clock();
.
.
// Some Processing
.
.
end = clock();
cout << "Elapsed Time" << (end-start) / CLK_TCK;
-
May 7th, 1999, 02:17 AM
#3
Re: program timing?
no, the problem with this solution is, u dont know how much time is spent in ur program.
it includes the time spent by other programs also that are running in background, like services.
what is needed is a program that runs at operating system level, so that it can record the time
while scheduling/dispatching.
Santosh Cheler
-
May 10th, 1999, 02:20 AM
#4
Re: program timing?
See the discussion on CPU Time on 95/98/NT, last post on 30/4/99.
[email protected]
B'lore
India.
-
May 10th, 1999, 04:09 AM
#5
Re: program timing?
Create the thread function for ur process. Just count no. of clocks spend during ur thread execution.
Algo..
global or static variable Total_clocks
Thread()
{
start_thread=clock();
....
...
....
end_thread=clock();
Total_clock+=(end_thread-start_thread);
}
The time spend by ur process will be executed in a thread & computing the time spend in a thread will give u the time u want as given by time() in unix.
If u have some thing on VXDs programming in windows please reply me.
surinder
ICQ #3760 3760
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|