Questions tagged [cpu-time]

103 questions
0
votes
1 answer

CPU Time Limit does not work in docplex api in python

I have set up docplex api in python and I am trying to run an optimization models. Based on IBM documentation, a CPU time limit can be set for the problem using the following command: mdl.solve(TimeLimit=60) However, this attribute does not work…
0
votes
0 answers

python multiprocessing yield quantum

I would like to make use of parallelization in my program by using the python multiprocessing library. For that purpose I want to check whether an action is right doable right now and if not yield the quantum of the current process and allow the…
0
votes
2 answers

CPU time in docplex - Python

Let us assume that I have created a mathematical model in python and want to solve it using the below code (the docplex library.) start = time.perf_counter() # CPU time calculator of the CPLEX solver # Obj 1 mdl.minimize(obj1) solution =…
mdslt
  • 155
  • 1
  • 10
0
votes
1 answer

Compute the "Time Complexity"

I hope you are doing well, I am computing the Time Complexity of my algorithm which has three nested for, but I did a trick by putting an if in the latest for like: for (i=0 ; i
0
votes
1 answer

How to get actual CPU time for some Python3 code

In general, I use time.time() to get CPU time for some my codes, for example: import time t_start = time.time() my_code() t_end = time.time() cpu_usage_time = t_end - t_start But actually, I don't know whether the cpu_usage_time is all used for my…
ShawnHe
  • 15
  • 3
0
votes
1 answer

RcppArmadillo function cpu times do not seem to scale linearly by increasing the data dimension and data size

I have written a function in both R and Rcpp, which basically just takes in a data-set x, a scale parameter gamma and a vector parameter beta, and hence returns the fitted probabilities. Below is the my code in…
0
votes
0 answers

Is using for loop faster for the computer than repeated instructions?

What I mean is which would be faster for a computer to execute. The following code is in python3. for in range(10): print('billy bob') OR print('billy bob') print('billy bob') print('billy bob') print('billy bob') print('billy…
epiconan
  • 11
  • 1
0
votes
0 answers

Does creating more threads and running them concurrently increase the CPU time of a process?

My question is why does running concurrently reduces execution time(compared to the sequential run of tasks in one thread)? As every process has a CPU time, it is only possible if the CPU time is increased when multiple threads are created and are…
lynxx
  • 544
  • 3
  • 18
0
votes
1 answer

Performance.now() in a multi threaded context

I need to use web workers for a demanding computation. I have const t0 = performance.now() and const t1 = performance.now() respectively at the beginning and the end of my code. I want to report t1 - t0 as the time required to perform the…
0
votes
0 answers

Conversion of function cputime to function tic toc

How to convert the cputime function to tic toc? syms x error = 0; fun = 0; N = 10; b = 4; a = 0; f = (1+x)^(3/2); f1 = @(y)(1+y)^(3/2); t = cputime; fun1 = double(int(f,x,a,b)); for N = 10:1000 fun = 0; h = (b-a)/N; for i = 0:h:4-h …
0
votes
1 answer

What is the " Unit " of time returned by psutil.cpu_times()?

Is it seconds? I am trying to match it with the output of top -n 1 | grep Cpu command, and they look different! >>> psutil.cpu_times() scputimes(user=678.99, nice=2.15, system=405.34, idle=414554.14, iowait=12.95, irq=0.0, softirq=2.43, steal=95.2,…
Anjana Shivangi
  • 397
  • 2
  • 5
  • 19
0
votes
1 answer

cpu time jumps a lot in virtual machine

I have a C++ program running with 20 threads (boost threads) on one of the RHEL6.5 systems virtualized in dell server. The result is deterministic, but the cpu time and wall time varies a lot in different runs. Sometimes, it takes 200s cpu time to…
Novak
  • 3
  • 3
0
votes
1 answer

What takes less CPU time/ what is faster/smaller load? AddOrUpdate or if/else with TryAdd?

I have KeyValuePairs and i want to add the new value to a ConcurrentDictonary. If the key is not contained i want to add it. But what is faster/better: this: dict.AddOrUpdate(pair.Key, pair.Value, (ok, ov) => pair.Value); or this: if…
0
votes
2 answers

grafana convert ps_cputime into percentage

I trying to plot memcached data in influxdb + grafana and i found ps_cputime is in microsecond. How do i convert it in human readable format so easy to understand. influxdb: > select * from memcached_syst limit 10; name: memcached_syst time …
Satish
  • 16,544
  • 29
  • 93
  • 149
0
votes
0 answers

isThreadCpuTimeSupported returning negative

I've been pulling my hair out over this. My program is supposed to measure the CPU time in searching a hashtable that uses a simple double hashing algorithm. However, ThreadMXBean keeps returning me -1. Any help is appreciated. Snippet of…
Cheryl
  • 67
  • 12