Questions tagged [cpu-usage]

CPU usage indicate how much of a workload is being handled by the CPU.

CPU-usage or CPU time is the amount of time for which a central processing unit (CPU) was used for processing instructions of a computer program.

CPU time accounting :http://public.dhe.ibm.com/software/dw/linux390/perf/CPU_time_accounting.pdf

2881 questions
62
votes
4 answers

Some fundamental but important questions about web development?

I've developed some web-based applications till now using PHP, Python and Java. But some fundamental but very important questions are still beyond my knowledge, so I made this post to get help and clarification from you guys. Say I use some…
Zhu Tao
  • 7,581
  • 9
  • 35
  • 38
61
votes
4 answers

Memory usage of Docker containers

I am using Docker to run some containerized apps. I am interested in measuring how much resources they consume (as far as regarding CPU and Memory usage). Is there any way to measure the resources consumed by Docker containers like RAM & CPU…
Paris
  • 6,323
  • 7
  • 31
  • 49
60
votes
15 answers

Command line command to auto-kill a command after a certain amount of time

I'd like to automatically kill a command after a certain amount of time. I have in mind an interface like this: % constrain 300 ./foo args Which would run "./foo" with "args" but automatically kill it if it's still running after 5 minutes. It…
dreeves
  • 26,430
  • 45
  • 154
  • 229
60
votes
7 answers

High CPU Utilization in java application - why?

I have a Java Application (web-based) that at times shows very high CPU Utilization (almost 90%) for several hours. Linux TOP command shows this. On application restart, the problem goes away. So to investigate: I take Thread Dump to find what…
Jasper
  • 8,440
  • 31
  • 92
  • 133
59
votes
13 answers

How can I programmatically limit my program's CPU usage to below 70%?

Of late, I'm becoming more health oriented when constructing my program, I have observed that most of programs take 2 or 3 minutes to execute and when I check on the task scheduler, I see that they consume 100% of CPU usage, can I limit this usage…
Nidhi
  • 667
  • 3
  • 8
  • 12
50
votes
7 answers

How to get total cpu usage in Linux using C++

I am trying to get total cpu usage in %. First I should start by saying that "top" will simply not do, as there is a delay between cpu dumps, it requires 2 dumps and several seconds, which hangs my program (I do not want to give it its own…
David Polák
  • 1,581
  • 4
  • 18
  • 33
49
votes
3 answers

Get CPU usage from application on iOS

How do I obtain CPU usage for an application? It's definitely possible, because there are application in App store (Activity Monitor Touch) which can show it.
ivanzoid
  • 5,952
  • 2
  • 34
  • 43
44
votes
4 answers

Prometheus - Convert cpu_user_seconds to CPU Usage %?

I'm monitoring docker containers via Prometheus.io. My problem is that I'm just getting cpu_user_seconds_total or cpu_system_seconds_total. How to convert this ever-increasing value to a CPU percentage? Currently I'm…
M156
  • 1,044
  • 1
  • 12
  • 29
42
votes
4 answers

Simulate steady CPU load and spikes

How could I generate steady CPU load in C#, lower than 100% for a certain time? I would also like to be able to change the load amount after a certain period of time. How do you recommend to generate usage spikes for a very short time?
kjv
  • 11,047
  • 34
  • 101
  • 140
42
votes
9 answers

Visual Studio 2013 Update 2 maxes out core

I recently installed Visual Studio 2013 Professional Update 2 on a Windows 7 virtual machine. I had been running VS 2012 with no problems, but I wanted to upgrade. Everything was working well for a week, but now for a certain project the IDE is…
Clint Powell
  • 2,368
  • 2
  • 16
  • 19
41
votes
6 answers

I need a slow C# function

For some testing I'm doing I need a C# function that takes around 10 seconds to execute. It will be called from an ASPX page, but I need the function to eat up CPU time on the server, not rendering time. A slow query into the Northwinds database…
Sisiutl
  • 4,915
  • 8
  • 41
  • 54
38
votes
2 answers

Why the cpu performance counter kept reporting 0% cpu usage?

PerformanceCounter cpuload = new PerformanceCounter(); cpuload.CategoryName = "Processor"; cpuload.CounterName = "% Processor Time"; cpuload.InstanceName = "_Total"; Console.WriteLine(cpuload.NextValue() + "%"); The output is always 0%, while the…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
37
votes
5 answers

what are the meaning of values at proc/[pid]/stat?

I was trying to develop an app to get CPU usage per app and kill apps when consuming much CPU. But I couldn't figure out how to do this. I have read this post and have seen this answer. So I looked at proc/[pid]/stat. There are a lot of numeric…
Shafin Abrar
  • 471
  • 1
  • 5
  • 12
37
votes
7 answers

CPU Intensive Calculation Examples?

I need a few easily implementable single cpu and memory intensive calculations that I can write in java for a test thread scheduler. They should be slightly time consuming, but more importantly resource consuming. Any ideas?
MEURSAULT
  • 8,307
  • 4
  • 24
  • 23
37
votes
5 answers

c# calculate CPU usage for a specific application

I'm trying to figure out how to get the CPU usage for a particular process but can only find information relating to overall CPU usage. Does anyone know how to extract the current CPU usage in percentage terms for a specific application?
Grant
  • 11,138
  • 32
  • 94
  • 140