Duncan, Justin,<div><br></div><div>I'm about to submit a series of patches that add writing capabilities for sample profiles in both text and binary formats. Soon, I'll add a third format (to make it interoperable with GCC).</div><div><br></div><div>I would like to add some profile maintenance utilities as well: merging, dumping and converting.</div><div><br></div><div>It seems like the best place would be tools/llvm-profdata. But that means that I need to have a way of distinguishing sample from instrumented profiles.</div><div><br></div><div>For the binary formats, it's easy to have the tool check the magic bits at the start, but for the text format it is not easy to tell whether we're dealing with a sample profile vs an instrumented profile.</div><div><br></div><div>The options I see are:</div><div><br></div><div>1- Add a --profile-type={sample|instr} to llvm-profdata to specify whether we are dealing with a sample or an instrumented profile. This would help prevent mixing and matching the two types of profiles (they are not convertible one to the other, not easily anyway).</div><div><br></div><div>2- Write a totally separate tool to deal with sample profiles.</div><div><br></div><div>I am slightly in favour of option #1. I could even make --profile-type=instr to avoid having a flag day for tools you may have deployed.</div><div><br></div><div><br></div><div>Thanks. Diego.</div>