Browse Source

parse bp fp point

tags/v1.2.0
taoxiangdong 3 years ago
parent
commit
877569858f
1 changed files with 25 additions and 12 deletions
  1. +25
    -12
      ge/common/profiling/profiling_manager.cc

+ 25
- 12
ge/common/profiling/profiling_manager.cc View File

@@ -809,28 +809,41 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::GetFpBpP
return;
}
// ProfApi mode and training trace is set
try {
char env_profiling_options[MSPROF_OPTIONS_DEF_LEN_MAX] = { 0x00 };
// Parse options first
char env_profiling_options[MSPROF_OPTIONS_DEF_LEN_MAX] = { 0x00 };
bool is_profiling_valid = false;
std::string profiling_options;
if (ge::GetContext().GetOption(OPTION_EXEC_PROFILING_OPTIONS, profiling_options) == SUCCESS &&
!profiling_options.empty()) {
is_profiling_valid = true;
} else {
INT32 ret = mmGetEnv("PROFILING_OPTIONS", env_profiling_options, MSPROF_OPTIONS_DEF_LEN_MAX);
if (ret != EN_OK) {
GELOGI("PROFILING_OPTIONS env is not exist.");
return;
}
GELOGI("Parse env PROFILING_OPTIONS:%s.", env_profiling_options);
Json prof_options = Json::parse(env_profiling_options);
profiling_options = env_profiling_options;
is_profiling_valid = true;
}
if (is_profiling_valid) {
try {
Json prof_options = Json::parse(profiling_options);

fp_point_ = prof_options[kFpPoint];
bp_point_ = prof_options[kBpPoint];
fp_point_ = prof_options[kFpPoint];
bp_point_ = prof_options[kBpPoint];

fp_point = fp_point_;
bp_point = bp_point_;
if (!fp_point_.empty() && !bp_point_.empty()) {
GELOGI("Training trace bp fp is set, bp_point:%s, fp_point:%s.", bp_point_.c_str(), fp_point_.c_str());
fp_point = fp_point_;
bp_point = bp_point_;
if (!fp_point_.empty() && !bp_point_.empty()) {
GELOGI("Training trace bp fp is set, bp_point:%s, fp_point:%s.", bp_point_.c_str(), fp_point_.c_str());
}
} catch (...) {
GELOGW("Json prof options is invalid.");
return;
}
} catch (...) {
GELOGE(FAILED, "Json prof options is invalid.");
return;
}
return;
}



Loading…
Cancel
Save