4 ms·
Another thing you can do: profile the process to find out what exactly it’s spending all that CPU time on. There are a few different ways to do this on macOS,
by comex 6y ago
Another thing you can do: profile the process to find out what exactly it’s spending all that CPU time on. There are a few different ways to do this on macOS, including the GUI Instruments.app which comes with Xcode, and dtrace. But if you’re the sort who always has a terminal open, the quickest way is to just run
sudo spindump
Also useful when a process is hung, even if it’s not taking up CPU time.
Sometimes the output isn’t useful due to a binary having been stripped of symbol names, but all macOS system libraries have symbols, so you can usually figure out something.
- codetrotter 6y agoSpeaking of the GUI Instruments.app. Is there a way to start a process from there, instead of attaching to an already running process? I used it the other day and could only figure out how to attach to an already running process with it.
- arcticbull 6y agoCreate a new profiling environment based on the template you're interested in, making sure "Choose a profiling template for:" is set to "Your Computer > All Processes." Next, in the top-left of the window, where it says "Your Computer > All Processes", click on All Processes. Select Choose Target... and navigate to your binary and hit Choose. Then hit the red circle to begin recording. This will launch a new instance of the specified binary and profile it. This may not work for binaries that set PT_DENY_ATTACH, though.
- codetrotter 6y agoThanks :)
- comex 6y agoYes, it’s possible. In the menu with all the processes, pick the option “Choose Target”. It’s kind of an annoying UI, but it works. Another option is to use `xcrun xctrace` to get a recording from the command line, which can then be opened in Instruments.
- z3t4 6y agoSo users are expected to run debugger tools in order to figure out what some hidden program is doing? Many years back I couldn't sleep and noticed my HDD's was working hard. I checked and it was google updater that was scanning everything... I will never know why, they might be stealing IP (i was working on OCR at the time) or they just wanted to create a profile to serve better ads...
- franklampard 6y agoThere is a GUI program as he said. By definition, “hidden” programs are not gonna tell you what they are doing up front.
- stjohnswarts 6y agoYep lots of responsible software companies will tell you what software is doing if it goes outside the parameters of their software. Say if a program is scanning your computer for information when it's really only supposed to be a web browser.
- saagarjha 6y agoHow else do you expect to figure out what a program is doing? Should it make a pop up with a stack trace from time to time?
- z3t4 6y agoMaybe a notification of what it is doing. "We are using your computer for machine learning" or "Currently upgrading Chrome". Or some sort of documentation on what the program is supposed to do.
- ehsankia 6y ago> So users are expected to run debugger tools in order to figure out what some hidden program is doing? That's like saying "So we're expected to investigate and have a full trial before sending someone to jail?". If you just want to delete it, go ahead. If you want to go as far as creating a whole domain to blame Chrome, yes, you do need more than just "I deleted it and coincidentally my computer got fast".