CPU threads state in OSX Terminal [duplicate] - macos

I've been looking for a osx utility that shows cpu usage for each cpu. For example
CPU 0 - 10%
CPU 1 - 2%
...
I know of many ways of getting this information in other Unix-like system (/proc, mpstat, etc) but none work in osx. The most useful one for Mac is top but it only shows total cpu usage. I need the application to be run from the shell so that I can log the usage over time. I also tried cpuwalk.d but it only shows you if the application is running in one or more cores.
If you take a look at Activity Monitor app you will notice that it basically displays the same info as top, but with the addition of a graph that shows cpus load.
If anyone has any idea of how to get the information I would appreciate it. Thanks.

You can try htop. If you have homebrew installed, simple install it via "brew install htop", after the installation finished, type in htop on the shell.

you can download os x hardware monitor src from: https://github.com/max-horvath/htop-osx

Related

High cpu usage by ruby interpreter after install

I've installed Ruby and the vscode extension so I can build a liquid theme for shopify.
The cpu usage is high when idle ~30%. After closing vscode the interpreter stays in memory and continues to use the same 30% cpu.
Is this normal? Does Ruby do some prep tasks in the background which will eventually complete and cpu will go to ~0 when idle and shutdown when I close vscode?
Or is the cpu usage always that high? I've looked around, this mac issue hints at it being the case without additional configuration and another says recompilation of Ruby solved their high cpu issue.
I'm running on Win 10
Cheers

How can I calculate interrupt latency in macOS?

When I was studying about I/O in my OS Class, I came to a following screenshot from an macOS looking terminal which is showing the total number of interrupts generated in 10 seconds-Image Here
can anyone please suggest from which command could I get this output, specially Macs with new ARM chips?
On intel macs, the command you want is called latency. See man latency. You can run it like so:
sudo latency -n /System/Library/Kernels/kernel
I'm not sure if this command is available for ARM based macs or not.

How to check IRQ latency in Linux (X86_64) for performance tuning?

Is there a way to check the interrupt processing latency in Linux kernel?
Or is there a way to check why CPU usage is only 40% in a specific configuration of Linux 4.19.138?
Background:
Currently I met a problem, I had a X86 server running either a 3rd party Linux-4.19.138 kernel (whose configuration file is about 6000 lines) or Ubuntu 20.04 X86_64 (whose configuration file is about 9500 lines long).
When running netperf test on this server , I found with the 3rd-party Linux-4.19.138 kernel, the IO latency of netperf is worse than with Ubuntu 20.04. The CPU usage is below 40% when running the 3rd party kernel, while it is about 100% when running Ubuntu 20.04.
They are using the same kernel command line and same performance profile in kernel runtime.
It seemed that the interrupt or the netserver process in the server is throttled in Linux-4.19.138.
Then, I rebuilt Ubuntu 20.04 kernel by using the short configuration file (6000 lines long), and got the similar bad results.
So it concluded that the kernel configuration made the difference.
Before comparing the 2 configurations (6000 lines vs 9500 lines), to narrow it down, my ask is, is there a way to check why CPU usage is only 40% in that configuration of 4.19.138? Or is there a way to check the interrupt processing latency in Linux kernel ?
I finally found the reason. It is from the
net.core.busy_read and
net.core.busy_poll are both to 0.
That means the socket polling is disabled, which impacts the netperf latency.
But the question changed to
In this case, the lower CPU usage is a sign that there is something different in Linux, what kind of tool or how can we should figure out what causes the CPU usage difference in 2 kernels?

Is there a min amount of ram to run create react app?

I find when I run create react app on my laptop then begin to code in VSCODE my laptop heats up a lot more than usual to the point its burning to the touch.
I have a macbook pro 2018 macos mojave fully upto date i5 8gb ram.
Is the reason for this low ram of 8gb?
Any information would be amazing.
Thanks
Nav
Not sure what to try?
npx create-react-app
Not expecting laptop to get unusually hot. Only happens when running create react app. also sometimes happens when running Atom IDE but does anyone even use that anymore?
No, the amount of ram you have should be more than sufficient to to VSCode and a create-react-app. Ram also has little impact on heat so I don't think that is causing the issue.
What you could try is to open the activity monitor to check if any processes are using more CPU than they should. Also check under the Energy-tab, that could give you a good guidance to what is causing your heating problem. As an example, I've had problems before where some of my VSCode plugins have had a bug that causes them to run at 100% CPU constantly.

XCode compiling extremely slow inside VMWare

The OSX 10.6.6 is installed inside VMware on Windows 7 host. The overall performance is great, However, the compiling time increased dramatically (1 hour against 2-3 min on pure MacOS). It's modern machine with Core i5 & 4GB RAM.
Here are the XBench results:
http://db.xbench.com/merge.xhtml?doc1=517768&doc2=1&setCookie=true
I think the problem could be in extremely slow 4k write value, but I don't know how to improve this.
Is there any way to increase performance?
UPD1: swap is not used, there is enough memory for all operations
the disk speed is also not related, since my another Macbook shows event worse results, and compiles hundreds times faster.
UPD2: problem solved, see my answer below
Sharing experience and solution.
My Xcode was running fine but when I build a project (even an empty one), it would take up to 10 minutes.
SOLUTION:
Go to Xcode -> Preference -> Source Control: Dissable Source Control
Now projects build and run in a matter of seconds.
In VMWare, you should have a setting where you can dedicate one or two cores entirely to the virtual machine. Assuming you have quad core, maybe give MacOSX 2 or 3 cores? If you have dual-core and you've allocated 1 core to the VM (and the problem still persists), i can't say much then!
It's good that your problem is solved, but I want to share my experience for improving vmware performance. Please do install VMware tools for mac os and they are present in .iso file.
Steps to install VMware tools for MAC OS:
1) Power on your VM.
2) At the right bottom they are some pop-up symbols(These are usually not present in full screen mode). Rightclick the CD/DVD symbol.
3) Click setting. In this window make sure that darwin.iso is selected.
4) Close this window and again right click CD/DVD symbol.
5) Click connect. An icon will appear with name darwin(300).
6) Inside this file tools are present. Install them!
The problem was: VERY SLOW recursive searching of include paths. If non-recursive, everything works smooth.
I also got the same problem, But i want share my personal experience here.
My CPUs RAM capacity is 4 GB, So i allocated 3.5 GB to the VMWare
because of this it was very slow the entire operating system.
So one day i clearly observed the VMWare settings, finally found the
solution. If we allocate the RAM memory more than recommended then
also your operating system hangs. For my System the recommended RAM
memory is 2048MB, after adjusting this now OS is fast.
We can adjust the RAM memory in Devices option, inside Hardware. For
clarification here i am attaching the screen shot.
I had the same problem and I fixed it as follow:
Most boost I got with changing my vmware config file to disable memory
stored in .vmem file. In my .vmx file I added :
mainMem.useNamedFile = "FALSE"
prefvmx.minVmMemPct = "100"
Setting max cores to the guest
When programming with swift and XCode. Remove all comments /* */ not really used.

Resources