def emit
pb = Protobuf.new
pb.int64(PROTO_TAGS[:profile][:time_nanos], @profile[:start_timestamp_ns] || 0)
pb.int64(PROTO_TAGS[:profile][:duration_nanos], @profile[:duration_ns] || 0)
pb.submessage(PROTO_TAGS[:profile][:sample_type], pb_value_type("samples", "count"))
pb.submessage(PROTO_TAGS[:profile][:sample_type], pb_value_type("cpu", "nanoseconds"))
pb.submessage(PROTO_TAGS[:profile][:period_type], pb_value_type("cpu", "nanoseconds"))
pb.int64(PROTO_TAGS[:profile][:period], inferred_period_ns)
build_functions(pb)
build_locations(pb)
build_samples(pb)
@strings.each do |s|
pb.string(PROTO_TAGS[:profile][:string_table], s)
end
buffer = StringIO.new
Zlib::GzipWriter.wrap(buffer) { |gz| gz.write(pb.to_bytes) }
buffer.string
end