1/* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18 19package perfetto.protos; 20 21// All the information that cannot be sent within a VulkanMemoryEvent message, 22// are sent as annotations to the main memory event. One example is the 23// properties of the object that consumes the allocated memory, for example, a 24// buffer or an image. 25// key_iid and string_iid are both interned strings. Original string value is 26// stored in vulkan_memory_keys from 27// protos/perfetto/trace/interned_data/interned_data.proto. 28message VulkanMemoryEventAnnotation { 29 optional uint64 key_iid = 1; 30 oneof value { 31 int64 int_value = 2; 32 double double_value = 3; 33 uint64 string_iid = 4; 34 } 35} 36 37// Each VulkanMemoryEvent encompasses information regarding one single function 38// call that results in reserving, binding or freeing host or GPU memory. There 39// is a special message type, ANNOTATIONS, which is used to communicate 40// information that are not directly related to a memory event, nonetheless are 41// essential to understand the memory usage. An example is the size and memory 42// types of the memory heaps. 43// 44// Next reserved id: 10 (up to 15). 45// Next id: 21. 46message VulkanMemoryEvent { 47 enum Source { 48 SOURCE_UNSPECIFIED = 0; 49 SOURCE_DRIVER = 1; 50 SOURCE_DEVICE = 2; 51 SOURCE_DEVICE_MEMORY = 3; 52 SOURCE_BUFFER = 4; 53 SOURCE_IMAGE = 5; 54 } 55 56 enum Operation { 57 OP_UNSPECIFIED = 0; 58 OP_CREATE = 1; // alloc, create 59 OP_DESTROY = 2; // free, destroy (non-bound) 60 OP_BIND = 3; // bind buffer and image 61 OP_DESTROY_BOUND = 4; // destroy (bound) 62 OP_ANNOTATIONS = 5; // only annotations 63 } 64 65 enum AllocationScope { 66 SCOPE_UNSPECIFIED = 0; 67 SCOPE_COMMAND = 1; 68 SCOPE_OBJECT = 2; 69 SCOPE_CACHE = 3; 70 SCOPE_DEVICE = 4; 71 SCOPE_INSTANCE = 5; 72 } 73 74 optional Source source = 1; 75 optional Operation operation = 2; 76 optional int64 timestamp = 3; 77 optional uint32 pid = 4; 78 optional fixed64 memory_address = 5; 79 optional uint64 memory_size = 6; 80 // Interned string. Original string value is stored in function_names from 81 // protos/perfetto/trace/interned_data/interned_data.proto. 82 optional uint64 caller_iid = 7; 83 optional AllocationScope allocation_scope = 8; 84 // Extra related information, e.g., create configs, etc. 85 repeated VulkanMemoryEventAnnotation annotations = 9; 86 87 // Field IDs used for device memory (low sampling rate) 88 optional fixed64 device = 16; 89 optional fixed64 device_memory = 17; 90 optional uint32 memory_type = 18; 91 optional uint32 heap = 19; 92 optional fixed64 object_handle = 20; 93} 94