How to customize the measure in the ansor

I want customize measure func(e.g. multiple operators using multi-stream, or not just latency…) I thought I needed to modify LocalRunner and Builder to get the data I wanted, but I had no idea how to do that (the code of Runner and Builder confused me). Or is there a more straightforward solution? (For example, how do I get cuda code directly from ansor and then return the data to measure func after profiling by myself way outside tvm?)