Questions tagged [cpu]

The central processing unit or "processor" inside a computer which executes the instructions in a computer program.

The central processing unit (CPU) is the portion of a computer system that carries out the instructions of a computer program, and is the primary element carrying out the computer's functions. The central processing unit carries out each instruction of the program in sequence, to perform the basic arithmetical, logical, and input/output operations of the system. This term has been in use in the computer industry at least since the early 1960s. The form, design and implementation of CPUs have changed dramatically since the earliest examples, but their fundamental operation remains much the same.

Source: Wikipedia

4662 questions
27
votes
4 answers

Profile specific animation CPU

The situation & problem I have multiple animations (css and javascript/jQuery) in my site and sometimes it makes my site stutter. My question How can I see how much cpu a specific animation (both CSS, JavaScript and jQuery) uses in runtime and…
Nick
  • 3,231
  • 2
  • 28
  • 50
27
votes
4 answers

In C++, is it better to cap a value using std::min or an if branch?

A very common pattern in programming is to cap a value at a maximum after some kind of update. What I'd like to know, is if there's a difference between the following two pieces of code, and if one should be preferred: value += increment; value =…
voltrevo
  • 9,870
  • 3
  • 28
  • 33
26
votes
1 answer

Assigning a cpu core to a process - Linux

Is there any way to force a process with specific PID, to be executed and run on only one of the cpu s of a server? I know that there is a command like this taskset -cp but the above command does not work on my system. So please…
Admia
  • 1,025
  • 3
  • 12
  • 24
26
votes
3 answers

How to read cpu frequency on android device

Is there any Java API for that? How can I read this information.
michael
  • 3,250
  • 10
  • 43
  • 58
25
votes
5 answers

Use of CPUQuota in systemd

I am trying to put a hard limit in CPU usage for a dd command . I have created the following unit file [Unit] Description=Virtual Distributed Ethernet [Service] ExecStart=/usr/bin/ddcommand CPUQuota=10% [Install] WantedBy=multi-user.target which…
SteveGr2015
  • 463
  • 2
  • 7
  • 15
25
votes
8 answers

Threading vs single thread

Is it always guaranteed that a multi-threaded application would run faster than a single threaded application? I have two threads that populates data from a data source but different entities (eg: database, from two different tables), seems like…
DarthVader
  • 52,984
  • 76
  • 209
  • 300
25
votes
2 answers

Redis performance on a multi core CPU

I am looking around redis to provide me an intermediate cache storage with a lot of computation around set operations like intersection and union. I have looked at the redis website, and found that the redis is not designed for a multi-core CPU. My…
Love Hasija
  • 2,528
  • 2
  • 27
  • 26
25
votes
5 answers

Programmable USB dongles

Where can I buy a programmable USB dongle that supports C as a development language?
Sakthikannan
  • 463
  • 3
  • 11
  • 17
24
votes
2 answers

What is the relation between CPU utilization and energy consumption?

What is the function that describes the relation between CPU utilization and consumption of energy (electricity/heat wise). I wonder if it's linear/sub-linear/exp etc.. I am writing a program that decreases the CPU utilization/load of other programs…
DuduAlul
  • 6,313
  • 7
  • 39
  • 63
24
votes
5 answers

Is there hardware support for 128bit integers in modern processors?

Do we still need to emulate 128bit integers in software, or is there hardware support for them in your average desktop processor these days?
Filip Haglund
  • 13,919
  • 13
  • 64
  • 113
24
votes
7 answers

How to get CPU utilization in % in terminal (mac)

Ive seen the same question asked on linux and windows but not mac (terminal). Can anyone tell me how to get the current processor utilization in %, so an example output would be 40%. Thanks
cyw
  • 520
  • 1
  • 4
  • 14
23
votes
2 answers

Python multiprocessing.cpu_count() returns '1' on 4-core Nvidia Jetson TK1

Can anyone tell me why Python's multiprocessing.cpu_count() function would return 1 when called on a Jetson TK1 with four ARMv7 processors? >>> import multiprocessing >>> multiprocessing.cpu_count() 1 The Jetson TK1 board is more or less straight…
Hephaestus
  • 1,982
  • 3
  • 27
  • 35
23
votes
1 answer

Using OperatingSystemMXBean to get CPU usage

I'm trying to use Java to get the percentage of CPU used by the currently running Java Virtual Machine. My research has pointed me to using the com.sun.management.OperatingSystemMXBean class. Following examples online, I've written the…
Kon
  • 10,702
  • 6
  • 41
  • 58
23
votes
5 answers

Why are 50 threads faster than 4?

DWORD WINAPI MyThreadFunction(LPVOID lpParam) { volatile auto x = 1; for (auto i = 0; i < 800000000 / MAX_THREADS; ++i) { x += i / 3; } return 0; } This function is run in MAX_THREADS threads.I have run the tests on Intel…
dizel3d
  • 3,619
  • 1
  • 22
  • 35
22
votes
3 answers

Linux display average CPU load for last week

On a Linux box, I need to display the average CPU utilisation per hour for the last week. Is that information logged somewhere? Or do I need to write a script that wakes up every 15 minutes to copy /proc/loadavg to a logfile? EDIT: I'm not allowed…
thornate
  • 4,902
  • 9
  • 39
  • 43