cpu-usage

iOS - Get CPU usage from application

孤街浪徒 提交于 2019-12-17 02:54:06
问题 Does anyone know how to obtain CPU usage for an application? It's definitely possible, because there are application in app store (Activity Monitor Touch) which can show it. 回答1: Update . This code is working for me: Update 2 . The thread_list was leaking, so added vm_deallocate #import <mach/mach.h> #import <assert.h> float cpu_usage() { kern_return_t kr; task_info_data_t tinfo; mach_msg_type_number_t task_info_count; task_info_count = TASK_INFO_MAX; kr = task_info(mach_task_self(), TASK

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

蓝咒 提交于 2019-12-17 01:46:22
问题 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 might be useful to generalize the idea to other constraints, such as autokilling a process if it uses too much memory. Are there any existing tools that do that, or has anyone written such a thing? ADDED: Jonathan's solution is precisely what I had in

How to get CPU usage in flash?

你离开我真会死。 提交于 2019-12-14 03:54:17
问题 I tried to find out but Google didn't help. Is there some way to get the cpu usage in flash or adobe AIR? I'm using ActionScript 3.0 and flash CS5. 回答1: In Flash, there is no way. In AIR, only native helper could do it. Flash platform has tough time with system programming, it's not its strength. 来源: https://stackoverflow.com/questions/5120270/how-to-get-cpu-usage-in-flash

How to show the CPU and disk usage in a JProgressBar?

早过忘川 提交于 2019-12-14 03:21:42
问题 I want to display the current cup usage and disk usage in two separate JProgressBar s. And also it should update second by second. How to do it using java? I am quite new to java programming, so please give me some code example. Thanks in advance. 回答1: You can use javasysmon-0.3.4.jar file to get the system related informations as CPU Usage,memory usage etc. Some of the methods are listed below and if you want something else you can explore. JavaSysMon monitor=new JavaSysMon(); //System.out

Chrome.system.cpu API Usage

笑着哭i 提交于 2019-12-14 00:36:47
问题 Is it possible to use the chrome.system.cpu api to get the current CPU load? I specifically can't figure out how to convert the returned numbers to a percent of the total current load. I found this, but not quite sure how to implement: "Callers can compute load fractions by making two calls, subtracting the times, and dividing by the difference in totalTime." https://developer.chrome.com/apps/system_cpu Answer : An example of getting CPU usage is here: https://github.com/beaufortfrancois/cog

pthread sleep function, cpu consumption

人盡茶涼 提交于 2019-12-13 18:58:31
问题 On behalf, sorry for my far from perfect English. I've recently wrote my self a demon for Linux (to be exact OpenWRT router) in C++ and i came to problem. Well there are few threads there, one for each opened TCP connection, main thread waiting for new TCP connections and, as I call it, commander thread to check for status. Every thing works fine, but my CPU is always at 100%. I now that its because of the commander code: void *CommanderThread(void* arg) { Commander* commander = (Commander*

Determine number of idle threads on remote machines

十年热恋 提交于 2019-12-13 18:37:58
问题 We are working on a script that will tell us how many threads are available on our groups 8 computers. I know that I can use cat /proc/cpuinfo | grep processor | wc -l to get the total number of threads, but we would like to know the number of available threads. By available threads I mean how many are currently not in use. We have multiple people accessing these computers and running jobs that require 1-12 threads at a time and would be nice to have a quick query instead of accessing each

Linux: CPU benchmark requiring longer time and different CPU utilization levels

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 11:10:12
问题 For my research I need a CPU benchmark to do some experiments on my Ubuntu laptop (Ubuntu 15.10, Memory 7.7 GiB, Intel Core i7-4500U CPU @ 1.80HGz x 4, 64bit). In an ideal world, I would like to have a benchmark satisfying the following: The CPU should be an official benchmark rather than created by my own for transparency purposes. The time needed to execute the benchmark on my laptop should be at least 5 minutes (the more the better). The benchmark should result in different levels of CPU

Set an application's resource limits (CPU usage)

為{幸葍}努か 提交于 2019-12-13 08:22:02
问题 It's a little strange I know, but I want to limit a program (for example the winrar app) resource usage. The reason: I have an old laptop, with overheating problem, so if I want to do a calculate intensive task (compress a >10GB folder), my laptop overheats and turns off. The question: Is it possible to limit an application's resource/CPU usage? For example, can I set somehow, that winrar can only use my CPU's 50%? I use windows 8.1, but answer for other OS is welcome. 回答1: See Are there

TActionlist, OnUpdate, High CPU Usage? [duplicate]

五迷三道 提交于 2019-12-13 06:43:53
问题 This question already has answers here : Why are : visible, control assigned TActions affecting the CPU usage of the application? (2 answers) Closed 6 years ago . I use the TActionslists OnUpdate event to enable or disable the buttons in my application. But I noticed my cpu using 25% of its capability. When I remove the code triggerd on the event my cpu usage still remains 25%. Only if I unhook the event completely does my cpu run at expected 1%. It seems the OnUpdate event fires way to many