Base profile's are derived from top-level spans, so it's recommended to ensure that you have an appropriately named span that encompasses the entire run of the program.
Dump flame spans to a writer, e.g. a file.
Convert flame spans to the speedscope profile format.
Dump flame spans to a writer, e.g. a file, specifying the spans you want to write.