尝试在函数返回处添加性能探查,但不起作用。

huangapple go评论55阅读模式
英文:

trying to add perf probe at function%return not working

问题

I'm trying to use perf to add 2 probe points, one each at the beginning and end of a function.

I get the name of the symbol (mangled, to work with perf) using this:

perf probe --funcs -x ./libVfeAecAndComms.so --no-demangle --filter='*'

which gives me 3 lines of output that are relevant for the function I'm after:

_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m
_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m
_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m@plt

The actual function is just AecElement::ProcessSubFrame() which returns void.

I can add a probe for the function entry using this:

perf probe -x ./libVfeAecAndComms.so --add psf_enter='_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m'

This seems to work with this message:

Added new event:
  probe_libVfeAecAndComms:psb_enter (on _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so)

I'm trying to add another probe point for the return from that function using the %return trick outlined in the documentation for perf-probe [1] as follows:

perf probe -x ./libVfeAecAndComms.so --add psf_ret='_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return'

but it gives me an error:

Failed to find symbol _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so
  Error: Failed to add events.

One other note: running objdump --t ./libVfeAecAndComms.so only lists the one symbol name, _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m

I'm not sure why the %return added to the mangled symbol name isn't recognized. I've seen a couple of blogs showing this exact approach and the man page seems to say it should work.

Is there another way to do this?

[1] https://linux.die.net/man/1/perf-probe

英文:

I'm trying to use perf to add 2 probe points, one each at the beginning and end of a function.

I get the name of the symbol (mangled, to work with perf) using this:

perf probe --funcs -x ./libVfeAecAndComms.so --no-demangle --filter='*'

which gives me 3 lines of output that are relevant for the function I'm after:

_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m
_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m
_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m@plt

The actual function is just AecElement::ProcessSubFrame() which returns void.

I can add a probe for the function entry using this:

perf probe -x ./libVfeAecAndComms.so --add psf_enter='_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m'

This seems to work with this message:

Added new event:
  probe_libVfeAecAndComms:psb_enter (on _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so)

I'm trying to add another probe point for the return from that function using the '
%return' trick outlined in the documentation for perf-probe [1] as follows:

perf probe -x ./libVfeAecAndComms.so --add psf_ret='_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return'

but it gives me an error:

Failed to find symbol _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so
  Error: Failed to add events.

One other note: running objdump --t ./libVfeAecAndComms.so only lists the one symbol name, _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m

I'm not sure why the %return added to the mangled symbol name isn't recognized. I've seen a couple of blogs showing this exact approach and the man page seems to say it should work.

Is there another way to do this?

[1] https://linux.die.net/man/1/perf-probe

答案1

得分: 1

It appears I only needed to add a --no-demangle at the end of the request to add the probe point. FWIW I didn't need this when I added the first probe point for the function entry.

Also, interesting to me is that it adds two probe points for this one call. I don't understand that, yet.

perf probe -x ./libVfeAecAndComms.so --add psf_return=_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return --no-demangle
Added new events:
probe_libVfeAecAndComms:psf_return__return (on _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so)
probe_libVfeAecAndComms:psf_return_1 (on _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so)

英文:

It appears I only needed to add a --no-demangle at the end of the request to add the probe point. FWIW I didn't need this when I added the first probe point for the function entry.

Also, interesting to me is that it adds two probe points for this one call. I don't understand that, yet.

perf probe -x ./libVfeAecAndComms.so --add psf_return=_ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return --no-demangle
Added new events:
  probe_libVfeAecAndComms:psf_return__return (on _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so)
  probe_libVfeAecAndComms:psf_return_1 (on _ZN10AecElement15ProcessSubFrameERK15VoiceAudioFrameIfERS1_m%return in /opt/Bose/bin/VfeElementLibs/AecElement/libVfeAecAndComms.so)

huangapple
  • 本文由 发表于 2023年4月7日 05:26:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75953916.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定