How to get the CPU usage of iPhone/iPad? - iphone

I saw in A+ monitor, it can show CPU Idle, CPU usage, CPU System. Which API should be used to get the these information? I have searched and I use the getloadavg function, but it can only return the CPU usage. Also it is not correctly for it will always be more than 90%.
Thanks!

Most of these can be retrieved using the appropriate sysctl() selectors.

Related

What to put for Kubernetes resource requests/limits?

I've seen articles recommending that resource requests/limit should be implemented. However, none I've found that discuss on what numbers to fill in.
For example, consider a container use zero CPU while idle, 80% under normal user requests and 200% CPU when hit by some rare requests:
If I put the maximum, 2000m as CPU request then a core would sit idle most of the time
On the other hand, if I request 800m and several pods are hitting their CPU limit at the same time the context switch overhead will kicks in
There are also cases like
Internal tools that sit idle most of the time, then jump to 200% on active use
Apps that have different peak time. For example, a SaaS that people use during working hours and a chatbot that start getting load after people leave work. It'd be nice if they could share the unused capacity.
Ideally vertical pod autoscaler would probably solve these problems automatically, but it is still in alpha today.
What I've been doing is to use telegraf to collect resource usage, and use the 95th percentile while the limit is set to 1 CPU and twice the memory request.
The problem with this method is
App that utilize multicores during startup, then under a core throughout their life will take longer to starts. I've observed a 2 minutes Spring startup become 5 minutes
Apps that are rarely used will have less resource reserved, and so have to rely on bursting capacity when it get invoked. This could be a problem if it has a surge in popularity.

Can I write a c program that actually alerts about my laptop battery?

Is it possible to write in C to get the alert. If yes, what is the concept to be applied to get an alert when my battery goes down by 40% or gets high to 80%?
You have to use Windows API to get the battery information. Please refer to the link: https://msdn.microsoft.com/en-us/library/windows/desktop/aa372659(v=vs.85).aspx
The following ioctls are used to get the battery information
IOCTL_BATTERY_QUERY_INFORMATION
IOCTL_BATTERY_QUERY_STATUS
IOCTL_BATTERY_QUERY_TAG
IOCTL_BATTERY_SET_INFORMATION
GetSystemPowerStatus function is used to get the power status in windows. Refer to the link: https://msdn.microsoft.com/en-us/library/windows/desktop/aa372693(v=vs.85).aspx

Unusual spikes in CPU utilization in CentOS 6.6 while starting pycharm

my system since last couple of days is behaving strangely. I am a regular user of pycharm software, and it used to work on my system very smoothly with no hiccups at all. But since last couple of days, whenever I start pycharm, my CPU utilization behaves strangly, like in the image: Unusual CPU util
I am confused as when I go to processes or try ps/top in terminal, there are no process which is utilizing cpu more then 1 or 2%. So I am not sure where these resources are getting consumed.
By unusual CPU util I mean, That first CPU1 is getting used 100% for couple or so minutes, then CPU2. Which is, only one cpu's utilization goes to 100% for sometime followed by other's. This goes on for 10 to 20 minutes. then system comes back to normal.
P.S.: I don't think this problem is related to pycharm, as I face similar issues while doing other work also, just that I always face this with pycharm for sure.
POSSIBLE CAUSE: I suspect you have a thrashing problem. The CPU usage of your applications are low because none of them are actually getting much useful work done. All the processing is being taken up by moving memory pages to and from the disk. Your CPU usage probably settles down after a time because your application has entered a state where its memory working set has shrunk to a point where it all can be held in memory at one time.
This has probably happened because one of the apps on your machine is handling a larger data set than before, and so requires more addressable memory. Another possibility is that, for some reason, a lot more apps are running on your machine.
POTENTIAL SOLUTION: There are several ways you can address this. The simplest is to put more RAM on your machine. If this doesn't work or isn't possible, you'll have to figure out which app is the memory hog. You may simply have to work with smaller problems/data-sets or offload some of the apps onto a different box.
MIGRATING CPU LOAD: Operating systems will move tasks (user apps, kernel) around for many different reasons. The reasons can range anywhere from it being just plain random to certain apps having more of their addressable memory in one bank vs another. Given that you are probably doing a lot of thrashing, I'm not surprised that the processor your app is running is randomized over time.

Solaris process taking up large CPU

I have a java process seens like taking up all the cpu processing power.
I thinking of killing it but how do i know what is the program that is actually causing such huge usage of solarsi cpu usage?
Try prstat -- it should show you how much CPU each process on your system is using.
Although this question was asked sometime back, I'm posting this so anyone can refer in future.
You can use the top command to investigate the issue. However, the thing with Solaris is, you have to turn off the Irix mode to get the real process information. While running top tool, press I to toggle the Irix mode.
More information can find here -> How to investigate CPU utilization in Solaris

What is Memory Monitor for the iPhone?

I've heard a lot of people talk of a tool called Memory Monitor as a better way to examine the memory usage of an iPhone app as Object Alloc doesn't give an accurate picture of how much memory an app is actually using.
How can I launch Memory Monitor? I can't find it in instruments. Is it a part of a separate tool I have to download?
Thanks!
Nick.
Memory Monitor is just one of the tools in Instruments. After you start your Instruments run (Xcode: Run > Start With Performance Tool > Leaks), click Library in the instruments window toolbar and drag Memory Monitor into the main window.
Memory Monitor is significant because it shows TOTAL memory usage by your app, whether or not that usage is reflected in ObjectAlloc.
The most important bar in Memory Monitor seems to be the last one, Total Memory Used. If this one keeps climbing, eventually your app will be toast. Drag the triangle control through the time bar (top of window) to get numeric value for any point in time.
If you're looking to help locate leaks in your code, try: http://clang.llvm.org/StaticAnalysis.html
Best Regards Richard L. Burton III
The "Leaks" Instruments template also monitors overall memory usage (and more.) The Activity Monitor application (/Applications/Utilities/Activity Monitor.app) may the be illusive "Memory Monitor." It has indications of real and virtual memory usage.
I'm not aware of any other tool explicitly called "Memory Monitor." If such an application exists, I can't imagine what other data it would obtain that Activity Monitor and Instruments wouldn't already be considering.