All you have to do is run a build with coverage enabled and then load the coverage data files into your IDE. At least Eclipse (with EclEmma) shows the results in a way that are pretty close to what you described. I'm sure other IDEs can do the same.
The only thing is that nobody does this on production, because of the performance impact and potentially increased risk.
I'm well aware of the performance impact on production, I guess it's the major challenge here.
Since I'm mainly developing in python - here's a good article about that, he gave some directions to make it faster: https://www.drmaciver.com/2017/09/python-coverage-could-be-f...
Code that was changed within the last week: red
Code that was changed within the last month: yellow
Code that hasn't been changed in over a month: normal
Code that hasn't been touched in over a year: green
Dead code: blink tag, DOOM music plays
https://docs.microsoft.com/en-us/visualstudio/ide/find-code-...
The benefits :
- I will understand during development which code is mission critical, and I should be careful with it, as well as invest more time in optimizing this code and document it better.
- I will understand what the customers do, which flows they use and which flows they avoid, so seeing code which I've developed recently but not used yet - will help me understanding that I'm wasting my time on writing unused features or we did not really understood the customers expectations.
- I will be able to cleanup dead code easily on the go.
It's like a theme park manager walking around in the park and watches which rides has long lines of people and which rides have no lines.. helps the manager understand where to put effort and which rides to remove / replace.