Rework performance interface.

I rewrote this and right as I was going to push, but there was a conflict. Here the merge is resolved.
I think this approach is cleaner overall.

Also fixes a bug where perf counters from libretro cores would go stale if game is swapped, etc.