我正在尝试使用dtrace来计算openGL中游戏的fps和macOS上的金属。但是,我一直收到错误说:
dtrace: error on enabled probe ID 2 (ID 86178: pid2741:OpenGL:CGLFlushDrawable:entry): invalid user access in action #1
当试图获得openGL游戏的fps而我不知道为什么。
这是我正在执行的程序的脚本:
#pragma D option switchrate=1000ms
#pragma D option bufsize=4m
BEGIN
{
i=timestamp;
diff=0;
}
pid$1:OpenGL:CGLFlushDrawable:entry,
objc$1:CAMetalLayer:-nextDrawable:entry
{
time = timestamp;
diff = time - i;
i = time;
printf("%s,%s,%d",execname, probefunc, diff);
}
ERROR
/pid==0/
{
time = timestamp;
diff = time - i;
i = time;
printf("%d\n",diff);
}
我从计数应用程序的github页面获得了上面的代码。