0

I need to get the CPU run time of my python application.

How to measure execution time of command in windows command line?

I came across the above thread earlier and learned about timeit. However, according to the download website, timeit is not supported in 64-bit Windows.

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17657#top

time.clock() does not give CPU time in Windows.

Is there any easy way to get the CPU time of my python application?

Community
  • 1
  • 1
jan
  • 1,773
  • 4
  • 16
  • 21
  • 1
    What is the purpose? Do you actually need the CPU time or do you just want to know how long it takes? There are built in Python tools like the `timeit` and `cProfile` modules that can do that for you. – agf Jul 28 '11 at 23:48
  • I need the CPU time to test the performance of two separate programs. Do you know what module can report the process time? I know that time.clock() gives the CPU time in Unix, but not in Windows. – jan Jul 29 '11 at 00:02

1 Answers1

0

If you're doing this just to profile or benchmark your code, don't building your own, use a built in library.

http://docs.python.org/library/profile.html

Charles Ma
  • 41,485
  • 21
  • 80
  • 98
  • Thanks that is exactly what I needed. – jan Jul 29 '11 at 00:07
  • The `profile` documentation explicitly says: "Note The profiler modules are designed to provide an execution profile for a given program, **not for benchmarking purposes** (for that, there is timeit for reasonably accurate results). " – np8 Nov 20 '20 at 20:56