I am profiling some multi-process nodejs code run on OSX.
我正在分析一些在OSX上运行的多进程nodejs代码。
I'm seeing:
我看到:
[C++]:
ticks total nonlib name
23398 63.6% 63.8% ___mac_get_pid
What is ___mac_get_pid
? It's name is certainly suggestive that it's some code that "gets a PID on a Mac", but the time seems excessive.
___mac_get_pid是什么?它的名字显然暗示着“Mac上有一个PID”,但时间似乎太长了。
Googling has provided nothing useful.
谷歌没有提供任何有用的信息。
1 个解决方案
#1
3
__mac_get_pid
is the syscall behind mac_get_pid
library function. It is described in man page mac_get
: http://man.cx/mac_get(3)
__mac_get_pid是mac_get_pid库函数后面的syscall。它在man页面mac_get中描述:http://man.cx/mac_get(3)
mac_get_pid .. get the label of a file, socket, socket peer or process The mac_get_pid() and mac_get_proc() system calls return the process label associated with an arbitrary process ID, or the current process.
mac_get_pid . .获取文件、套接字、套接字对等点或进程mac_get_pid()和mac_get_proc()系统调用的标签,返回与任意进程ID或当前进程相关联的进程标签。
Label storage for use with these calls must first be allocated and prepared using the mac_prepare(3) functions. When an application is done using a label, the memory may be returned using mac_free(3).
使用这些调用的标签存储必须首先使用mac_prepare(3)函数进行分配和准备。当应用程序使用标签完成时,可以使用mac_free(3)返回内存。
The "MAC" here is not Mac OS X / macOS, but POSIX.1e's Mandatory Access Control ("was introduced in FreeBSD 5.0 as part of the TrustedBSD Project"). The mac_get_pid
is implemented in macOS/Dawrin/XNU as "Extended non-POSIX.1e interfaces".
这里的“MAC”不是MAC OS X / macOS,而是POSIX.1e的强制访问控制(“作为TrustedBSD项目的一部分,FreeBSD 5.0引入了这个控制)。mac_get_pid在macOS/Dawrin/XNU中实现为“扩展的非posix”。1 e接口”。
Possibly there is some methods in used nodejs libraries which try to do detailed work with process lists (like ps/top), but they were unable to limit rate of their requests. Getting several stacktraces with mac_get_pid
either with profiler (not v8 profiler which stacktraces only js, but some external profiler attached to nodejs process) or with debugger (gdb/lldb) by manual stopping and checking backtrace until you find who calls mac_get_pid
(continue and stop again when you are not in mac_get_pid
) is the needed step to find out who did call it.
在使用的nodejs库中可能存在一些方法,它们尝试使用流程列表(如ps/top)进行详细的工作,但是它们无法限制请求的速率。得到几个加mac_get_pid与分析器(不是v8分析器只加js,但一些外部分析器连着nodejs过程)或调试器(gdb / lldb)通过手动停止和检查回溯,直到你找到召mac_get_pid(再继续和停止当你不在mac_get_pid)所需的步骤来找出是谁干的。
#1
3
__mac_get_pid
is the syscall behind mac_get_pid
library function. It is described in man page mac_get
: http://man.cx/mac_get(3)
__mac_get_pid是mac_get_pid库函数后面的syscall。它在man页面mac_get中描述:http://man.cx/mac_get(3)
mac_get_pid .. get the label of a file, socket, socket peer or process The mac_get_pid() and mac_get_proc() system calls return the process label associated with an arbitrary process ID, or the current process.
mac_get_pid . .获取文件、套接字、套接字对等点或进程mac_get_pid()和mac_get_proc()系统调用的标签,返回与任意进程ID或当前进程相关联的进程标签。
Label storage for use with these calls must first be allocated and prepared using the mac_prepare(3) functions. When an application is done using a label, the memory may be returned using mac_free(3).
使用这些调用的标签存储必须首先使用mac_prepare(3)函数进行分配和准备。当应用程序使用标签完成时,可以使用mac_free(3)返回内存。
The "MAC" here is not Mac OS X / macOS, but POSIX.1e's Mandatory Access Control ("was introduced in FreeBSD 5.0 as part of the TrustedBSD Project"). The mac_get_pid
is implemented in macOS/Dawrin/XNU as "Extended non-POSIX.1e interfaces".
这里的“MAC”不是MAC OS X / macOS,而是POSIX.1e的强制访问控制(“作为TrustedBSD项目的一部分,FreeBSD 5.0引入了这个控制)。mac_get_pid在macOS/Dawrin/XNU中实现为“扩展的非posix”。1 e接口”。
Possibly there is some methods in used nodejs libraries which try to do detailed work with process lists (like ps/top), but they were unable to limit rate of their requests. Getting several stacktraces with mac_get_pid
either with profiler (not v8 profiler which stacktraces only js, but some external profiler attached to nodejs process) or with debugger (gdb/lldb) by manual stopping and checking backtrace until you find who calls mac_get_pid
(continue and stop again when you are not in mac_get_pid
) is the needed step to find out who did call it.
在使用的nodejs库中可能存在一些方法,它们尝试使用流程列表(如ps/top)进行详细的工作,但是它们无法限制请求的速率。得到几个加mac_get_pid与分析器(不是v8分析器只加js,但一些外部分析器连着nodejs过程)或调试器(gdb / lldb)通过手动停止和检查回溯,直到你找到召mac_get_pid(再继续和停止当你不在mac_get_pid)所需的步骤来找出是谁干的。