I need the "perf" utility to monitor the program on my Mac. I know linux comes with it, but is it available on Mac?
I am working on a OSX 10.9 Mavericks and tried "port search" for perf or linux-tools, but I couldn't get any results.
As #Sami Laine said in his comment, the Linux perf tool is dependent on Linux specific code. It relies on the perf_event_open system call which is not standardized.
Note: Maybe you could search how MacOSX users are using recent hardware performance counters.
Instruments app
On macOS you can use the Instruments application to profile your code.
I like to use the "Time Profiler" which will show you how much time your application is its various parts during execution. I haven't used perf myself, but from talks/videos that I've seen this seems to be the most common use.
To use the "Time Profiler":
Run Instruments, select Time Profiler
At the top left, select your target (executable).
Hit the Record button on the top left and let it run for a little
while.
Pause or Stop the execution and drill down on your calls in the main
window.
Hope this helps.
On OSX you can use sample together with filtercalltree.
Both have useful help text if you run them without commands, but an example invocation to sample process id 1234 for the default 10 seconds at 1ms resolution would be something like:
sample 1234 -f output.prof
filtercalltree output.prof
Once you've generated your call graph, FlameGraph is another great tool for visualizing it, and it supports sample call graphs via the stackcollpase-sample.awk script.
Check out Google Perf Tool
If you dont have brew installed:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
If you have brew installed:
brew install google-perftools
Reference: https://github.com/gperftools/gperftools
Related
So I am trying to get started developing on Fuchsia and I wanted to get the hello world component to run. However, following these steps doesn't work for me. I'm using core.qemu-x64 running on an Ubuntu 20.04 VM with Virtual Box. I have gotten the emulator to run with fx qemu -N but fx vdl start -N hasn't worked for me.
I run fx serve-updates but it just outputs "Discovery..." and never changes. Then I try to run fx shell run fuchsia-pkg://fuchsia.com/hello-world-cpp#meta/hello-world-cpp.cmx but it says "No devices found." It seem like this shouldn't be an issue because with Linux the device finder should automatically pick it up. Regardless I tried following the MAC instructions and setting the device with fx set-device 127.0.0.1:22. That just makes the run command say "ssh: connect to host 127.0.0.1 port 22: Connection refused". I also tried to set it to the device to the nodename outputted by the fx qemu -N command which is "fuchsia-####-####-####" but that just makes the run command say no devices are found again.
I have verified that I actually have the hello-world packages with the fx list-packages hello-world which outputs all the hello-world packages as expected.
Is there any way I can get the device to be discoverable by the shell command? Alternatively, can I run components like the hello-world component from the qemu emulator directly?
Please let me know if I can provide any additional information.
I guess I just wasn't patient enough. I assumed the emulator was done getting setup because it stopped giving console output and it allowed me to input commands but it seems I just had to wait longer. After 50 minutes of the fx qemu -N command running, the terminal that had fx serve-updates going finally picked up the device. Then I was able to execute the hello world component. It would be nice if the documentation at least gave an idea of how long the different commands would take before they'd be usable.
I know that one can use Activity Monitor to check if a process is running via Rosetta on Apple Silicon. I wonder if there is a way to do the same with the terminal?
Edit:
The process is some other application, so if there is a way to check if this process is running in Rosetta a possible command could maybe have the syntax:
$ is_running_under_rosetta <pid>
which would output
yes or no.
By using following command you can check if the process is running under Rosetta(1) or not(0, natively).
sysctl -n sysctl.proc_translated
Confirm that you are using the Native Terminal by typing arch, which should return arm64: Terminal app screenshot running arch command and returning arm64
Similar to the issue #37033541, my commands do not stop. However, my system does not have unmounted drives; my GOPATH is set to /users/user_name/go:/users/user_name/goCode. Neither changing this path to the installation default, nor restarting the computer, or even starting a shell without my bashrc change the behaviour. While it is running, it does generate a functional executable.
I am running go 1.14.1 installed according to the instructions for macOS Mohave.
This behaviour replicates across other packages in my system. But transferring the code to the Go Playground or another Mac computer does not replicate the behaviour. When I run go build -x ..., the last action is: rm -r $WORK/b001/.
Running a stack trace on the process yields ongoing system calls that I cannot interpret (They do seem varied and would be happy to post some if someone would think them useful).
This did not use to happen, it started a few hours ago. I would appreciate the help of someone in troubleshooting this issue.
The issue was resolved only by putting in a fresh installation of the OS and then reinstalling go 1.14.1.
More here: https://groups.google.com/forum/#!topic/golang-nuts/YxqX9o2YJ4k
I just updated Xcode to 11.4 and suddenly my terminal (iTerm 3.3.9) is now very slow. Typing a command works fine, but upon pressing enter I often wait 3-4 seconds to perform a simple task (cd, git add, etc).
When I look at the status bar I notice that xcodebuild is running during the time while I am waiting. I'm assuming that the new Xcode update did something that makes this process longer or needs a setting updated somewhere.
I have already tried sudo xcodebuild -license accept and that did not fix the problem. Additionally, there is no xcodebuild call inside of my .zshrc file.
Where can I find out what the terminal is trying to do with Xcodebuild? I suspect identifying the command being run is the first step towards determining how to fix it.
FWIW, this problem also happens in the Apple-provided terminal, so I don't think it's iTerm specific.
I've found many answers but at the first start the console is still very slow (15s).
At end looking around I found out that somehow it's nvm that needs xcodebuild.
The slowdown was fixed changing the nvm default to system
nvm alias default system
I have a prompt. I want to send a clear or ls to all my byobu windows (opened with F2), by typing it only once.
Is there a way to do that?
This was such a phenomenal question, and something that I've been wanting to do for so long, that I just put a couple of scripts together, added to Byobu-5.73, and released the new feature :-)
As of that version of Byobu, you can now use Shift-F9 to enter a command and send to all panes (splits), or Ctrl-F9 to enter a command and send to all windows.
You can watch a demo here: http://blog.dustinkirkland.com/2014/09/apply-updates-to-multiple-systems.html
This feature is available in Ubuntu 14.04 LTS (trusty), or you can always install the latest version from ppa:byobu/ppa or build/install from source.
Full disclosure: I am the author and maintainer of Byobu.