• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
59    // alloc, create
60    OP_CREATE = 1;
61
62    // free, destroy(non-bound)
63    OP_DESTROY = 2;
64
65    // bind buffer and image
66    OP_BIND = 3;
67
68    // destroy (bound)
69    OP_DESTROY_BOUND = 4;
70
71    // only annotations
72    OP_ANNOTATIONS = 5;
73  }
74
75  enum AllocationScope {
76    SCOPE_UNSPECIFIED = 0;
77    SCOPE_COMMAND = 1;
78    SCOPE_OBJECT = 2;
79    SCOPE_CACHE = 3;
80    SCOPE_DEVICE = 4;
81    SCOPE_INSTANCE = 5;
82  }
83
84  optional Source source = 1;
85  optional Operation operation = 2;
86  optional int64 timestamp = 3;
87  optional uint32 pid = 4;
88  optional fixed64 memory_address = 5;
89  optional uint64 memory_size = 6;
90  // Interned string. Original string value is stored in function_names from
91  // protos/perfetto/trace/interned_data/interned_data.proto.
92  optional uint64 caller_iid = 7;
93  optional AllocationScope allocation_scope = 8;
94  // Extra related information, e.g., create configs, etc.
95  repeated VulkanMemoryEventAnnotation annotations = 9;
96
97  // Field IDs used for device memory (low sampling rate)
98  optional fixed64 device = 16;
99  optional fixed64 device_memory = 17;
100  optional uint32 memory_type = 18;
101  optional uint32 heap = 19;
102  optional fixed64 object_handle = 20;
103}
104