perf tools: Refactor all_tids to hold nr and the map