In this article, I will tell you what is macOS sample process and how to use the macOS sample process to analyze the macOS process issue.
1. What Is macOS Sample Process?
- Sample Process is a built-in utility on macOS that allows you to monitor and troubleshoot processes running on your computer.
- It captures a snapshot of the process’s activity and generates a report that can be used to diagnose issues or identify resource usage.
- When you use Sample Process, it captures a series of stack traces, which are snapshots of the process’s call stack at a given point in time.
- These stack traces can be used to identify the functions or methods that the process is currently executing, and can help pinpoint performance issues or resource usage.
- The Sample Process utility is available in the Activity Monitor application on macOS.
- You can use it to sample any process currently running on your computer, including system processes and third-party applications.
2. How To Use Sample Process In macOS?
- The Sample Process is a built-in utility on Mac that allows you to monitor and troubleshoot processes running on your computer. Here are the steps to use Sample Process.
- Open the Activity Monitor by searching for it in Spotlight or navigating to Applications > Utilities > Activity Monitor.
- Select the process you want to sample by clicking on it in the list of processes.
- Click on the Gear icon on the macOS activity monitor top left corner.
- Then click the “Sample Process” menu item from the drop-down list.
- A new window will appear displaying a sample of the process’s activity. You can use this information to diagnose issues or identify resource usage.
- To save the sample, click on the “Save” button in the toolbar and choose a location to save the file.
- There is also a Display drop-down list in the sample process dialog window top left corner.
- There are several items in the display drop-down list, such as Sample Text, Number of Samples, Number of Seconds, Percent of Parent, and Percent of Thread.
- Below is an example of the sample process content.
Sampling process 801 for 3 seconds with 1 millisecond of run time between samples Sampling completed, processing symbols... Analysis of sampling Android File Transfer Agent (pid 801) every 1 millisecond Process: Android File Transfer Agent  Path: /Users/USER/Library/Application Support/Google/*/Android File Transfer Agent.app/Contents/MacOS/Android File Transfer Agent Load Address: 0x100238000 Identifier: com.google.android.mtpagent Version: 1.0.507.1136 Code Type: X86-64 Parent Process: ???  Date/Time: 2023-04-02 10:52:43.655 +0800 Launch Time: 2023-04-02 08:49:59.061 +0800 OS Version: Mac OS X 10.15.7 (19H524) Report Version: 7 Analysis Tool: /usr/bin/sample Physical footprint: 1784K Physical footprint (peak): 1856K ---- Call graph: 2732 Thread_8064 DispatchQueue_1: com.apple.main-thread (serial) + 2732 start (in Android File Transfer Agent) + 52 [0x1002395d4] + 2732 main (in Android File Transfer Agent) + 1426 [0x10023a1ba] + 2732 -[NSRunLoop(NSRunLoop) run] (in Foundation) + 76 [0x7fff34addc7f] + 2732 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] (in Foundation) + 212 [0x7fff34a2b1d8] + 2732 CFRunLoopRunSpecific (in CoreFoundation) + 466 [0x7fff3236d953] + 2732 __CFRunLoopRun (in CoreFoundation) + 1329 [0x7fff3236e4e1] + 2732 __CFRunLoopServiceMachPort (in CoreFoundation) + 247 [0x7fff3236fa27] + 2732 mach_msg (in libsystem_kernel.dylib) + 60 [0x7fff6b9ff170] + 2732 mach_msg_trap (in libsystem_kernel.dylib) + 10 [0x7fff6b9fedfa] 2732 Thread_8478 2732 start_wqthread (in libsystem_pthread.dylib) + 15 [0x7fff6bac1b77] 2732 _pthread_wqthread (in libsystem_pthread.dylib) + 390 [0x7fff6bac2aa1] 2732 __workq_kernreturn (in libsystem_kernel.dylib) + 10 [0x7fff6ba004ce] Total number in stack (recursive counted multiple, when >=5): Sort by top of stack, same collapsed (when >= 5): __workq_kernreturn (in libsystem_kernel.dylib) 2732 mach_msg_trap (in libsystem_kernel.dylib) 2732 Binary Images: 0x100238000 - 0x100241ff7 +com.google.android.mtpagent (1.0.507.1136) <40B4DF54-D212-3FC9-8261-BD44FD765A6D> /Users/*/Library/Application Support/Google/*/Android File Transfer Agent.app/Contents/MacOS/Android File Tra