1 /* Copyright 2016 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_PROFILER_INTERNAL_PRINT_MODEL_ANALYSIS_H_ 17 #define TENSORFLOW_CORE_PROFILER_INTERNAL_PRINT_MODEL_ANALYSIS_H_ 18 19 #include <string> 20 21 #include "tensorflow/core/framework/types.h" 22 23 namespace tensorflow { 24 namespace tfprof { 25 struct Options; 26 27 // ********************** 28 // APIs in this file are only for swig. 29 // Talk to xpan@ if you want to call it directly! 30 // ********************* 31 32 // Multi-step Profiler. 33 // 34 bool NewProfiler(const string* graph, const string* op_log); 35 36 void DeleteProfiler(); 37 38 double AddStep(int64 step, const string* graph, const string* run_meta, 39 const string* op_log); 40 41 // Write the profiler's profile to a proto buffer. 42 void WriteProfile(const string* filename); 43 44 // Load the profile to profiler from a proto buffer file. 45 void ProfilerFromFile(const string* filename); 46 47 // Returns a binary string that represents the serialized ProfileProto. 48 string SerializeToString(); 49 50 string Profile(const string* command, const string* options); 51 52 // Single-step Profiler. 53 // 54 // Interface defined for Python API swig. Calls the tfprof core API. 55 // 'graph', 'run_meta', 'op_log' are serialized GraphDef, RunMetadata, 56 // OpLogProto strings, respectively. 57 // 'graph', 'command' and 'options' are required. Others can be nullptr 58 // if not available. 59 string PrintModelAnalysis(const string* graph, const string* run_meta, 60 const string* op_log, const string* command, 61 const string* options); 62 63 } // namespace tfprof 64 } // namespace tensorflow 65 66 #endif // TENSORFLOW_CORE_PROFILER_INTERNAL_PRINT_MODEL_ANALYSIS_H_ 67