Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What if I want to get a count of how many times a particular instruction is called? #5

Open
philtomson opened this issue Jun 3, 2022 · 3 comments

Comments

@philtomson
Copy link

I'd like to count the number of times a particular multiply-accummulate instruction is called (specifically vfmadd231ps) in an executable. Is this possible? If so, how would one go about it?

@gamozolabs
Copy link
Collaborator

That's somewhat tricky. Right now the best way would be to have that information in the cannoli server (like load a json file with the addresses you want to instrument that have the appropriate opcodes). I could maybe send the instruction bytes up so they could be inspected at lift time!

@philtomson
Copy link
Author

I could maybe send the instruction bytes up so they could be inspected at lift time!

that would be useful.

@stsquad
Copy link

stsquad commented Oct 7, 2022

You can use the existing execlog plugin for a rough and ready count (I'm doing cvtss2sd as I don't have a test case using vfmadd handy):

$ ./qemu-x86_64 -plugin ./contrib/plugins/libexeclog.so,ifilter="cvtss2sd" -d plugin -D cvt.log ./tests/tcg/x86_64-linux-user/float_madds
...
$ cat cvt.log | cut -d "," -f 4,5 | sort | uniq -c
    380  "cvtss2sd %xmm0, %xmm0"
   1520  "cvtss2sd %xmm0, %xmm1"
    760  "cvtss2sd %xmm1, %xmm1"
    376  "cvtss2sd %xmm2, %xmm2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants