Questions tagged [cpu-time]
103 questions
3
votes
2 answers
Is this the proper way to time concurrent threads in Java
I need to time how long it takes to run each thread of an application I wrote, and I have finished and have a result, but don't really have any good way to verify that I did it right. I've never done anything like this before. If someone could give…

Stephen Bendl
- 73
- 8
3
votes
1 answer
How can i limit cpu usage of windows processes using C#
I need to write a class that will attach to certain windows processes, monitor and limit their cpu usage.
Process priority changing would not help me at all so i really need to write a program that is basically similar to BES or ThreadMaster.
So i…

Igor Gajic
- 39
- 2
3
votes
2 answers
Is this a valid method for CPU time comparison between C++ and Python?
I'm interested in comparing CPU times some code portions written C++ vs Python (running on Linux). Will the following methods produce a "fair" comparison between the two?
Python
Using the resource module:
import resource
def cpu_time():
return…

Matt Hancock
- 3,870
- 4
- 30
- 44
3
votes
2 answers
CPU time, or User time in Java for computer science experiments?
When evaluating my algorithms against one another in regards to time taken should I use CPU or User time in Java? I used the information here: How to get CPU, system, and user time for benchmarking, to get these values...
Here we go:
"User time" is…

José
- 1,525
- 3
- 14
- 12
2
votes
2 answers
Why Am I Getting Different Time Values
I've tried this code in C++ on Win7x64 platform with MSVC++, and I got CPU frequency about 2900000 ticks per second.
When I run this program, my stopwatch returns about 10,000,000 tick, which means it take about 4 seconds to process my program,…

user1060028
- 41
- 1
2
votes
1 answer
VisualVM Profiler: How to test CPU Time for a method with varying parameter sizes?
Suppose I have a method that can take in a parameter is size n (Like an array with size n); is it possible to investigate the CPU Times for the method with varying array sizes in an automated manner using VisualVM's Profiler?
Currently I only know…

Ymi
- 609
- 6
- 18
2
votes
1 answer
Best method to measure CPU time in Python3?
I am curious what the current best method is for measuring CPU time in Python3. To be clear, the result I want is the total CPU clock time that the program has been running (i.e. not wall clock time).
I have used the time module for this in the…

Elijah Pelofske
- 123
- 3
2
votes
1 answer
Is there any way reduce the I/O wait times in linux jobs?
I am running a multiple parallel file handling process (minimum 200 processes) where each process is reading a logs of varying size(0-50mb) to capture a real time data of the logs .I am running my jobs on 16 cores and 8 gb ram Linux machine.
But…

vikas chib
- 83
- 8
2
votes
0 answers
Java ThreadMXBean getCurrentThreadCpuTime Unix Windows different accuracy
I'm executing the following code in Java to print the elapsed CPU time (both in nano and milliseconds):
ThreadMXBean bean = ManagementFactory.getThreadMXBean();
long t = bean.getCurrentThreadCpuTime();
int c = 0;
…

user899000
- 41
- 1
- 5
2
votes
1 answer
Which one should i use for benchmark tasks in hadoop user+sys time or total cpu time spent in hadoop job counter?
In this one statement in a answer written that "same job running over the same data but on one 20 node cluster, then a 200 node cluster.Overall, the same amount of CPU time will be used on both clusters" Can someone explain this ?
I've used time…

Dhruv Kapatel
- 873
- 3
- 14
- 27
2
votes
1 answer
Is CLOCK_THREAD_CPUTIME_ID the same as pthread_getcpuclockid(pthread_self(),..)?
In terms of obtaining per-thread CPU time using Posix clock_gettime(): is there any difference between using the clock ID obtained from pthread_getcpuclockid(pthread_self(),..) or using CLOCK_THREAD_CPUTIME_ID?

Steve Robbins
- 479
- 5
- 16
2
votes
1 answer
How to go from CPU time to CPU utilization?
I'm trying to recognize a run away threads in my own application and close them for good before they render machine inaccessible.
However, I can only get CPU time for the thread, that is limitation of API I'm using. Is there any way to evaluate CPU…

vava
- 24,851
- 11
- 64
- 79
2
votes
2 answers
Are execution time and memory usage the only relevant performance indicators for PHP? What about CPU?
I'm using a PHP framework which has an ActiveRecord system. I quickly ran into trouble with ActiveRecord using a lot of memory and having long execution times for complex queries with large results.
For my reference page (a script generating an…

preyz
- 3,029
- 5
- 29
- 36
2
votes
1 answer
How to implement cpu-time timeout for script/program in linux?
It's crucial to measure not user time for some program/script, but the cpu time and kill it when this time limit will be breached.
What's the best way to do it?
One of the most obvious solutions is to check with some time step process tree to see if…

Ribtoks
- 6,634
- 1
- 25
- 37
1
vote
2 answers
Problem about cpu time and wall time in jupyternotebook
As a physics student, I have a questions I would like to ask you about program runtime.
I'm doing a small project about algorithm optimization, my toy code is written on jupyternotebook, but when I use %%time and %%timeit in cell to test cpu time…

clearlove
- 11
- 3