On 09/09/2020 13.27, Alex Bennée wrote: > We have an exploding complexity problem in the testing so lets just > move the more involved plugins into contrib. tests/plugins still exist > for the basic plugins that exercise the API. We restore the old > pre-meson style Makefile for contrib as it also doubles as a guide for > out-of-tree plugin builds. > > While we are at it add some examples to the documentation and a > specific plugins build target. [...] > diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst > index a05990906cc..e079695caf9 100644 > --- a/docs/devel/tcg-plugins.rst > +++ b/docs/devel/tcg-plugins.rst > @@ -134,3 +134,145 @@ longer want to instrument the code. This operation is > asynchronous > which means callbacks may still occur after the uninstall operation is > requested. The plugin isn't completely uninstalled until the safe work > has executed while all vCPUs are quiescent. > + > +Example Plugins > +=============== > + > +There are a number of plugins included with QEMU and you are > +encouraged to contribute them upstream.
s/contribute them/contribute your own plugins/ ? > There is a `contrib/plugins` > +directory where they can go. > + > +- tests/plugins > + > +These are some basic plugins that are used to test and exercise the > +API during the `make check-tcg` target. > + > +- contrib/plugins/hotblocks.c > + > +The hotblocks plugin allows you to examine the where hot paths of > +execution are in your program. Once the program has finished you will > +get a sorted list of blocks reporting the starting PC, translation > +count, number of instructions and execution count. This will work best > +with linux-user execution as system emulation tends to generate > +re-translations as blocks from different programs get swapped in and > +out of system memory. > + > +If your program is single-threaded you can use the `inline` option for > +slightly faster (but not thread safe) counters. > + > +Example:: > + > + ./aarch64-linux-user/qemu-aarch64 -plugin contrib/plugins/libhotblocks.so > -d plugin ./tests/tcg/aarch64-linux-user/sha1 Maybe break long lines with a backslash ? > + SHA1=15dd99a1991e0b3826fede3deffc1feba42278e6 > + collected 903 entries in the hash table > + pc, tcount, icount, ecount > + 0x0000000041ed10, 1, 5, 66087 > + 0x000000004002b0, 1, 4, 66087 > + ... > + > +- contrib/plugins/hotpages.c > + > +Similar to hotblocks but this time tracks memory accesses:: > + > + ./aarch64-linux-user/qemu-aarch64 -plugin contrib/plugins/libhotpages.so > -d plugin ./tests/tcg/aarch64-linux-user/sha1 dito ? Thomas
