I'm working on a python project and my guide asked me to keep the CPU load less than 7000dmips. How can I do that?
Asked
Active
Viewed 213 times
1 Answers
1
Dhrystone MIPS (Million Instructions per Second), or DMIPS
According to PEP 611
The actual hard limits enforced by Python will be:
Version Hard limit
3.9 16 million
3.10 onward 8 million
Given the rarity of code generators that would exceed the one million limits, and the environments in which they are typically used, it seems reasonable to start issuing warnings in 3.9 if any limited quantity exceeds ranges.
Historically the recursion limit has been set as follows. To avoid breaking code that implicitly relies on the value being small, the soft recursion limit will be increased gradually, as follows:
Version Soft limit
3.9 4 000
3.10 16 000
3.11 64 000
3.12 125 000
3.13 1 million
Python code is too far away from CPU operations.
But basic formula is
**DMIPS = (Processor clock speed * Num Instructions executed per cycle)/(10^6)**.
try to obtian one by one parameters
in Linux
perf stat --all-user ./my_program
on Linux will use CPU performance counters to record how many user-space instructions it ran, and how many core clock cycles it took. And how much CPU time it used, and will calculate average instructions per core clock cycle for you, e.g.
3,496,129,612 instructions:u # 2.61 insn per cycle
similarly to find Processor clock speed
by
usage = winstats.get_perf_data(r'\Processor(_Total)\% Processor Time',
fmts='double', delay=100)
print(' CPU Usage: %.02f %%' % usage)
Just you need to plug this outputs & need to calculate the DMIPS
for your program..
I guess there is no direct way...You need to work step by step & connect the dots
ref How to calculate MIPS of my processor?
ref Benchmarking - How to count number of instructions sent to CPU to find consumed MIPS

Bhargav - Retarded Skills
- 3,154
- 1
- 6
- 22