Solved

How to measure CPU time?

Posted on 1998-12-24
3
795 Views
Last Modified: 2013-11-15
Often in research paper, the author compares
the execution time of a algorithm by plotting
CPU time vs the input data (e.g number
of elements to be processed).
How is CPU time determined?

In Window NT Task Manager, in the "Processes" property page
there is a column on "CPU time" for the various processes.
How do we interprete these numbers?
0
Comment
Question by:leowlf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1181034
In research papers, the CPU time is a theoretical unit of time. Basically, each atomic statement is treated as one unit of time. A statement in C++ would be one unit of time, i.e. assuming i is of type integer,

  i = 3;

would be O(1) (time complexity of 1).

But a for loop would be measured by the number of times through the loop:

  for (int j = 0; j < 10; j++)
  {
    i = 3;
  }

This would be O(10) because i = 3 takes O(1) and the for loop gets executed 10 times. Therefore the overall loop is O(10). In general if there are n iterations through a loop and the statement inside the loop is O(1), then the time complexity of the loop is n * O(1), which is O(n).

But these are all theoretical units of CPU time. On NT, the CPU time is the amount of time in seconds spent executing the statements in the program. These are real times and is dependent on the CPU in the machine.

These times have a relationship to the theoretical CPU units of time, but to calculate it would be near impossible because there are too many things that can change it.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1181035
O(10) is the same as O(1)
0
 
LVL 11

Expert Comment

by:alexo
ID: 1181036
For NT, you can use the GetProcessTimes() function.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question