Hello,

Can someone help me understand better GCC's profile driven instrumentation? I know this can be a long topic, but I am not looking for a long discussion. I am just trying to orient myself regarding GCC's FDO implementation.

1. I know that gcc uses an instrumentation based profiler. This instrumentation based profiler instruments binaries when the flag `-fprofile-use` is used. I also know that `gprof` is also a gnu profiler that can also generate profiling information that can be consumed by gcc. Does the profiler used when the flag `-fprofile-use` share some code with `gprof`? Are they the same?

2. I know that the profiler used with `-fprofile-use` can generate basic block frequencies and branch probabilities. Does it also profile the call graph? I am specifically interested in callsite edge counters with a context sensitivity of k = 1. This is to say that if I have the following method:

```
int guard(void* (func_ptr)(void))
{
  if (func_ptr == some_function)
  {
    func_ptr(); // call site 1
  } else {
    func_ptr(); // call site 2
  }
}
```

profiling information should be enough to say the target of the call site 1 is always some_function and the target of the call site 2 can be any function which was stored in func_ptr that is not some_function.


3. I know that there are other profilers that are able to generate data that can be consumed by GCC. In particular there is AutoFDO. According to the options available on GCC, this is still an option available. Are there any other profilers that you know about that can generate profile data used by GCC?

Reply via email to