• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_CORE_COMMON_RUNTIME_METRICS_H_
17 #define TENSORFLOW_CORE_COMMON_RUNTIME_METRICS_H_
18 
19 #include "tensorflow/core/platform/types.h"
20 
21 namespace tensorflow {
22 namespace metrics {
23 
24 // Records that a tf.data.Dataset executed by the program used autotuning.
25 //
26 // The `name` argument identifies the Dataset type (e.g. "ParallelMap").
27 void RecordTFDataAutotune(const string& name);
28 
29 // Records the number of bytes read from the filesystem by a tf.data.Dataset
30 // source.
31 //
32 // The `name` argument identifies the Dataset type (e.g. "TFRecordDataset").
33 void RecordTFDataBytesRead(const string& name, int64 num_bytes);
34 
35 // Records the number of elements produced by a tf.data.Dataset.
36 //
37 // The `name` argument identifies the Dataset type (e.g. "Batch" or "Map").
38 void RecordTFDataElements(const string& name, int64 num_elements);
39 
40 // Records the number of independent graph changes resulting from the
41 // application of a tf.data optimization.
42 //
43 // The `name` argument identifies the optimization (e.g. "noop_eliminiation").
44 void RecordTFDataOptimization(const string& name, int64 num_changes);
45 
46 void UpdateGraphExecTime(const uint64 running_time_usecs);
47 
48 // Updates the metrics stored about time spent building graphs.
49 //
50 // By "GraphBuild", we refer to building a client graph, which is a sub-graph of
51 // the full graph, induced by a set of options. In particular, these options
52 // include the feeds and fetches requested.
53 //
54 // This includes time spent:
55 //   * optimizing the graphs with Grappler
56 //   * pruning the sub-graph (unless the place_pruned_graph option is set)
57 //
58 // When executing eagerly, this will not record any activity.
59 //
60 // TODO(jtkeeling): Should we record building/optimizing tf.functions?
61 void UpdateGraphBuildTime(const uint64 running_time_usecs);
62 
63 }  // namespace metrics
64 }  // namespace tensorflow
65 
66 #endif  // TENSORFLOW_CORE_COMMON_RUNTIME_METRICS_H_
67