Hello,
I want to made hardware profiling. For that purposes I need to have
instrumented source code that has to be profiled. At every beginning and end
of function and program loops writing to one register must be inserted. Each
faction write different value in that register. My hardware detects access
to that register, which function had access and time when that access was
happen.
For source code instrumentation I want to use gcc. As gcc is very complex
software, I hope that you can help me.
I read gecko documentation, and it seems to me that -pg or -test-coverage
options can be used for this purpose. Can you please tell me what exactly
these options do? Do they insert some code before compiling or before
linking? Where is it in gcc source code? Can I easy change that code with
writing to some register? Is it possible to set profiling hierarchy level
(for example: to add extra code only on "main" function instead of whole
source)?
The -pg option puts a function call at the beginning of each function to
mcount. The -pg option doesn't put anything at the end of the function.
This is probably not going to be very useful for what you are interested
in doing.