Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to measure CPU time?

Posted on 1998-12-24
3
Medium Priority
?
800 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 200 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

730 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