1// This proto describes the format of the output profile file from 2// the tf.data stats tool. 3syntax = "proto3"; 4 5package tensorflow.profiler; 6 7// Stat for iterator. 8message IteratorStat { 9 // Id of the iterator. 10 int64 id = 1; 11 // Start time of the iterator's GetNext in ps. 12 int64 start_time_ps = 2; 13 // Duration of the iterator's GetNext in ps. 14 int64 duration_ps = 3; 15 // Self time of the iterator's GetNext in ps. It takes account into async 16 // iterators. It is calculated by subtracting the time overlapped with its 17 // child iterator's duration from the iterator's duration. 18 int64 self_time_ps = 4; 19 // Whether it is blocking the root iterator. An async iterator's child 20 // iterator may not block its parent iterator if it is executed in advance and 21 // does not overlap with the parent iterator. 22 bool is_blocking = 5; 23 // The number of times this iterator is called. For example, a batch 24 // iterator's child iterator may be called multiple times. 25 int64 num_calls = 6; 26} 27 28// Metadata for iterator. 29message IteratorMetadata { 30 // Id of the iterator. 31 int64 id = 1; 32 // Id of the parent iterator. 33 int64 parent_id = 2; 34 // Name of the iterator. 35 string name = 3; 36 // Long name of the iterator. 37 string long_name = 6; 38 // Whether it is an async iterator. 39 bool is_async = 4; 40 // Parameters of the iterator (e.g., num_parallel_calls). 41 map<string, string> params = 5; 42} 43 44// Stat and metadata for input pipeline. 45message InputPipelineStat { 46 // Id of the blocking iterator with the longest self time. 47 int64 bottleneck_iterator_id = 2; 48 // Latency of the bottleneck iterator. 49 int64 bottleneck_iterator_latency_ps = 3; 50 // Stats per iterator. 51 map<int64, IteratorStat> iterator_stats = 1; 52} 53 54// Metadata for input pipeline. 55message InputPipelineMetadata { 56 // The distribution strategy creates one "host" input pipeline which actually 57 // runs tf.data user code. Also, it creates a "device" input pipeline per 58 // device (e.g., TensorCore) which takes an element from the host input 59 // pipeline and transfers it to the device. 60 enum InputPipelineType { 61 HOST = 0; 62 DEVICE = 1; 63 } 64 // Id of the input pipeline which is set to the id of its root iterator. 65 int64 id = 1; 66 InputPipelineType type = 2; 67 string name = 4; 68 reserved 3; 69} 70 71// Collection of metadata and stats of input pipeline. 72message InputPipelineStats { 73 // Metadata of the input pipeline. 74 InputPipelineMetadata metadata = 1; 75 // Average latency (i.e., the root iterator's latency) of the input pipeline. 76 int64 avg_latency_ps = 3; 77 // Minimum latency of the input pipeline. 78 int64 min_latency_ps = 4; 79 // Maximum latency of the input pipeline. 80 int64 max_latency_ps = 5; 81 // The number of times this input pipeline was slower than 50 us. 82 int64 num_slow_calls = 6; 83 // Stats per call sorted by the root iterator's duration. 84 repeated InputPipelineStat stats = 2; 85} 86 87// Collection of stats of tf.data input pipelines within a host. 88message TfDataStats { 89 // Metadata per iterator. 90 map<int64, IteratorMetadata> iterator_metadata = 2; 91 // Stats per input pipeline. 92 map<int64, InputPipelineStats> input_pipelines = 1; 93} 94 95message TfDataBottleneckAnalysis { 96 // Host name. 97 string host = 1; 98 // Input pipeline name. 99 string input_pipeline = 2; 100 // Maximum latency of the input pipeline. 101 int64 max_latency_ps = 3; 102 // Name of the bottleneck iterator. 103 string iterator_name = 4; 104 // Long name of the bottleneck iterator. 105 string iterator_long_name = 5; 106 // Latency of the bottleneck iterator. 107 int64 iterator_latency_ps = 7; 108 // Suggestion to resolve the bottleneck. 109 string suggestion = 6; 110} 111 112// TfDataStats of all hosts. 113message CombinedTfDataStats { 114 // Whether it is input bound. 115 bool is_input_bound = 3; 116 // Summary of the analysis. 117 string summary = 4; 118 // Bottleneck analysis result. 119 repeated TfDataBottleneckAnalysis bottleneck_analysis = 1; 120 // TfDataStats per host. 121 map<string, TfDataStats> tf_data_stats = 2; 122} 123