Return ALREADY_EXISTS instead of UNAVAILABLE error when profiling is already active

Makes C++ code consistent with python APIs.

PiperOrigin-RevId: 360493350
Change-Id: I37f3400dcd7fc2a9841b7e8d313a3ae7911bac00
This commit is contained in:
Jose Baiocchi 2021-03-02 12:48:59 -08:00 committed by TensorFlower Gardener
parent b2cd7ad7d2
commit f07914d9d7

View File

@ -118,7 +118,7 @@ ProfilerSession::ProfilerSession(ProfileOptions options)
options_(std::move(options)) {
#if !defined(IS_MOBILE_PLATFORM)
if (!active_) {
status_ = tensorflow::Status(error::UNAVAILABLE,
status_ = tensorflow::Status(error::ALREADY_EXISTS,
"Another profiler session is active.");
return;
}