Re: hello, is there anyway to count number of executed instructions of a function
Philippe Waroquiers via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2022-09-02 at 11:16 +0000, 李硕(lishuo122587 - 新诛仙世界服务器组) wrote: > Dear programmers, > Hello, I’m a newer, does someone known how to count number of executed instructions of a function? > > Yours, sincerely > > 从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送 > To my knowledge, GDB does not have such a feature. But for sure, there are various tools that can do that. E.g. see valgrind https://valgrind.org/docs/manual/manual.html and in particular the sections about callgrind and cachegrind (and possibly the lackey tool). Note that kcachegrind is a nice visualisation tool for callgrind output. On linux, the "perf" command might also do what you want (significantly faster than valgrind, which have a high performance impact). Philippe