节点概要文件中的___mac_get_pid符号是什么? [英] What is the ___mac_get_pid symbol in a node profile?

查看:106
本文介绍了节点概要文件中的___mac_get_pid符号是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在分析OSX上运行的一些多进程nodejs代码.

I am profiling some multi-process nodejs code run on OSX.

我看到了:

[C++]:
   ticks  total  nonlib   name
  23398   63.6%   63.8%  ___mac_get_pid

什么是___mac_get_pid?它的名字肯定暗示着它是在Mac上获取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.

Google搜索没有提供任何有用的信息.

Googling has provided nothing useful.

推荐答案

__mac_get_pidmac_get_pid库函数背后的系统调用.在手册页mac_get中进行了描述: http://man.cx/mac_get(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()和mac_get_proc()返回与任意进程ID或当前进程关联的进程标签.

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_prepare(3)函数进行分配和准备.使用标签完成应用程序后,可以使用mac_free(3)返回内存.

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"不是Mac OS X/macOS,而是 POSIX.1e 强制性访问控制(是是 TrustedBSD 项目的一部分在FreeBSD 5.0中引入的. mac_get_pid在macOS中实现的/Dawrin/XNU 作为扩展的非POSIX.1e接口".

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".

可能在使用过的nodejs库中有一些方法试图对进程列表(例如ps/top)进行详细的工作,但是它们无法限制请求的速率.通过mac_get_pid或通过探查器(不是 v8探查器)获得多个堆栈跟踪仅 js ,但将某些外部探查器附加到nodejs进程)或与调试器(gdb/lldb),方法是手动停止并检查回溯,直到找到谁调用了mac_get_pid(不在mac_get_pid时继续并再次停止),这是找出谁调用了它的必要步骤.

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.

这篇关于节点概要文件中的___mac_get_pid符号是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆