cpu

Win32: Calculate Thread CPU Utilization in a Multi-Core / Multi-Processor System

浪子不回头ぞ 提交于 2019-12-21 17:42:23
问题 I am currently working on an MFC application that needs to be CPU-utilization aware. It may have multiple threads at different points in time, but the bulk of the work is accomplished by the main thread. I am trying to find a way to calculate how much percentage of the CPU this main thread utilizes. However, I am running into some problems as to how exactly to accomplish this in a multi-CPU / multi-Core environment. The problem is that most system calls seems to give system information,

Are extended instruction sets (SSE, MMX) used in Linux kernel?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 13:03:01
问题 Well, they bring (should bring at least) great increase in performance, isn’t it? So, I haven’t seen any Linux kernel sources, but ‘d love to ask: are they used somehow? (In this case – there must be some special “code-cap” for system that has no such instructions?) 回答1: The SSE and MMX instruction sets have limited value outside of audio/video and gaming work. You might find a few explicit uses in dark corners of the kernel, but I wouldn't count on it. The answer in the general case is "no,

Throttling CPU from within Java

做~自己de王妃 提交于 2019-12-21 10:35:36
问题 I have seen many questions in this (and others) forum with the same title, but none of them seemed to address exactly my problem. This is it: I have got a JVM that eats all the CPU on the machine that hosts it. I would like to throttle it, however I cannot rely on any throttling tool/technique external to Java as I cannot make assumptions as to where this Vm will be run. Thus, for instance, I cannot use processor affinity because if the VM runs on a Mac the OS won't make process affinity

CPU Utilization high for sleeping processes

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 07:09:18
问题 I have a process that appears to be deadlocked: # strace -p 5075 Process 5075 attached - interrupt to quit futex(0x419cf9d0, FUTEX_WAIT, 5095, NULL It is sitting on the "futex" system call, and seems to be indefinitely waiting on a lock. The process is shown to be consuming a large amount of CPU when "top" is run: # top -b -n 1 top - 23:13:18 up 113 days, 4:19, 1 user, load average: 1.69, 1.74, 1.72 Tasks: 269 total, 1 running, 268 sleeping, 0 stopped, 0 zombie Cpu(s): 8.1%us, 0.1%sy, 0.0%ni,

How many CPU cores has a heroku dyno?

妖精的绣舞 提交于 2019-12-21 06:56:19
问题 I'm using Django with Celery 3.0.17 and now trying to figure out how many celery workers are run by default. From this link I understand that (not having modified this config) the number of workers must be currently equal to the number of CPU cores. And that's why I need the former. I wasn't able to find an official answer by googling or searching heroku's dev center. I think it's 4 cores as I'm seeing 4 concurrent connections to my AMQP server, but I wanted to confirm that. Thanks, J 回答1:

Qt QSplitter and unresponsive GUI (cpu 100%)

☆樱花仙子☆ 提交于 2019-12-21 06:49:13
问题 I'm trying to implement the following layout |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| | | | | | | | QTABWIDGET | QGLWIDGET | | | | | | | |_______________|________________| | | | | | TEXTEDIT | |________________________________| Between the TabWidget and GLWidget the layout is governed by a QSplitter with horizontal orientation. Another QSplitter with vertical orientation is needed between the previous splitter and QTextEdit widget so that I can choose to hide the textedit. Currently my

Why is it that restricting multithreaded applications to one core make it run faster?

旧城冷巷雨未停 提交于 2019-12-21 05:42:14
问题 I have a native multithreaded Win32 application written in C++ which has about 3 relatively busy threads and 4 to 6 threads that don't do that much. When it runs in a normal mode total CPU usage adds up to about 15% on an 8-core machine and the application finished in about 30 seconds. And when I restrict the application to only one core by setting the affinity mask to 0x01 it completes faster, in 23 seconds. I'm guessing it has something to do with the synchronization being cheaper when

Benchmarking CPU-bound algorithms/implementations

爱⌒轻易说出口 提交于 2019-12-21 05:15:16
问题 Let's say I'm writing my own StringBuilder in a compiled language (e.g. C++). What is the best way to measure the performance of various implementations? Simply timing a few hundred thousand runs yields highly inconsistent results: the timings from one batch to the other can differ by as much as 15%, making it impossible to accurately assess potential performance improvements that yield performance gains smaller than that. I've done the following: Disable SpeedStep Use RDTSC for timing Run

How does this code calculate the number of CPU cycles elapsed?

て烟熏妆下的殇ゞ 提交于 2019-12-21 04:02:27
问题 Taken from this SO thread, this piece of code calculates the number of CPU cycles elapsed running code between lines //1 and //2 . $ cat cyc.c #include<stdio.h> static __inline__ unsigned long long rdtsc(void) { unsigned long long int x; __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); return x; } int main() { unsigned long long cycles = rdtsc(); //1 cycles = rdtsc() - cycles; //2 printf("Time is %d\n", (unsigned)cycles); return 0; } $ gcc cyc.c -o cyc $ ./cyc Time is 73 $ ./cyc Time is 74 $

High CPU usage of javascript - How to debug?

假装没事ソ 提交于 2019-12-21 03:28:05
问题 What is the best way to find the cause of high cpu usage of javascript? I have a script that simply loads photos from flickr in a thumbnail gallery. After they're loaded, nothing is being done (waiting for you to click them to display in a lightbox), but the cpu usage is still 25% or more. I've opened firebug, clicked profile, waited a bit then clicked it again, but it says "No activity to report". If there was something going on, wouldn't it report? Or am I using this tool wrong? I am doing