You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: wait_for_perfetto.go
    path of file: ./repos/gapid/gapis/api/vulkan
    
    the code of the file until where you have to start completion: // Copyright (C) 2019 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (
    
func addVkDeviceWaitIdle(ctx context.Context, out transform.Writer) {
	s := out.State()
	so := getStateObject(s)
	id := api.CmdNoID
	cb := CommandBuilder{Thread: 0, Arena: s.Arena}

	// Wait for all queues in all devices to finish their jobs first.
	for handle := range so.Devices().All() {
		out.MutateAndWrite(ctx, id, cb.VkDeviceWaitIdle(handle, VkResult_VK_SUCCESS))
	}
}