@@ -29,6 +29,7 @@ limitations under the License.
2929#include " tensorflow/core/framework/tensor.pb.h"
3030#include " tensorflow/core/lib/core/errors.h"
3131#include " tensorflow/core/platform/errors.h"
32+ #include " tensorflow/core/platform/tracing.h" // NOLINT
3233#include " tensorflow/core/protobuf/error_codes.pb.h"
3334#include " tensorflow/core/protobuf/named_tensor.pb.h"
3435#include " tensorflow/core/tfrt/runtime/tf_threadpool_concurrent_work_queue.h"
@@ -190,12 +191,14 @@ absl::Status RunPredict(
190191 }
191192
192193 if (IsOutputFilterEmptyOrFullSet (request, function_metadata.value ())) {
194+ TRACELITERAL (" Pre process prediction without output filter" );
193195 // Pre-processing.
194196 std::vector<Tensor> input_tensors;
195197 TF_RETURN_IF_ERROR (PreProcessPredictionWithoutOutputFilter (
196198 function_metadata.value (), request, &input_tensors));
197199
198200 // Executes requests.
201+ TRACELITERAL (" Execute prediction without output filter" );
199202 std::vector<Tensor> outputs;
200203 const uint64_t start_microseconds = EnvTime::NowMicros ();
201204 if (const auto status =
@@ -213,6 +216,7 @@ absl::Status RunPredict(
213216 end_microseconds - start_microseconds);
214217
215218 // Post-processing.
219+ TRACELITERAL (" Post process prediction without output filter" );
216220 return PostProcessPredictionResultWithoutOutputFilter (
217221 function_metadata->GetOutputNames (), outputs, option, request,
218222 response);
@@ -229,13 +233,15 @@ absl::Status RunPredict(
229233 }
230234 const SignatureDef& signature = iter->second ;
231235
236+ TRACELITERAL (" Pre process prediction with output filter" );
232237 std::vector<std::pair<string, Tensor>> input_tensors;
233238 std::vector<string> output_tensor_names;
234239 std::vector<string> output_tensor_aliases;
235240 TF_RETURN_IF_ERROR (PreProcessPrediction (signature, request, &input_tensors,
236241 &output_tensor_names,
237242 &output_tensor_aliases));
238243
244+ TRACELITERAL (" Execute prediction with output filter" );
239245 const uint64_t start_microseconds = EnvTime::NowMicros ();
240246 std::vector<Tensor> outputs;
241247 if (const auto status = saved_model->RunByTensorNames (
@@ -253,6 +259,7 @@ absl::Status RunPredict(
253259 /* runtime=*/ " TFRT" ,
254260 end_microseconds - start_microseconds);
255261
262+ TRACELITERAL (" Post process prediction with output filter" );
256263 return PostProcessPredictionResult (output_tensor_aliases, outputs, option,
257264 response);
258265 }
0 commit comments