This makes the profiler much more useful by actually distiguishing different derivations being evaluated. This does make the implementation a bit more convoluted, but I think it's worth it.
The tests are mostly based on existing `function-trace.sh` with some tests for corner cases.