Common log optimize

pull/1328/head
liyihan2@huawei.com 4 years ago
parent 4ef1970f6d
commit 1c5465cd22

@ -155,7 +155,7 @@ std::shared_ptr<GraphInfo> Analyzer::GetJsonObject(uint64_t session_id, uint64_t
std::lock_guard<std::recursive_mutex> lg(mutex_); std::lock_guard<std::recursive_mutex> lg(mutex_);
auto iter = graph_infos_.find(session_id); auto iter = graph_infos_.find(session_id);
if (iter == graph_infos_.end()) { if (iter == graph_infos_.end()) {
GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! graph_id:%lu.", session_id, graph_id); GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! graph_id:%lu", session_id, graph_id);
return nullptr; return nullptr;
} else { } else {
auto iter1 = (iter->second).find(graph_id); auto iter1 = (iter->second).find(graph_id);
@ -200,7 +200,7 @@ ge::Status Analyzer::CreateAnalyzerFile() {
} }
ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_id) { ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_id) {
GELOGD("start to save analyze file!"); GELOGD("start to save analyze file");
auto graph_info = GetJsonObject(session_id, graph_id); auto graph_info = GetJsonObject(session_id, graph_id);
GE_CHECK_NOTNULL(graph_info); GE_CHECK_NOTNULL(graph_info);
@ -232,7 +232,7 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_
} }
ge::Status Analyzer::DoAnalyze(DataInfo &data_info) { ge::Status Analyzer::DoAnalyze(DataInfo &data_info) {
GELOGD("start to do analyzer process!"); GELOGD("start to do analyzer process");
auto pnode = data_info.node_ptr; auto pnode = data_info.node_ptr;
GE_CHECK_NOTNULL(pnode); GE_CHECK_NOTNULL(pnode);

@ -25,7 +25,7 @@ void CustAICPUKernelStore::AddCustAICPUKernel(const CustAICPUKernelPtr &kernel)
} }
void CustAICPUKernelStore::LoadCustAICPUKernelBinToOpDesc(const std::shared_ptr<ge::OpDesc> &op_desc) const { void CustAICPUKernelStore::LoadCustAICPUKernelBinToOpDesc(const std::shared_ptr<ge::OpDesc> &op_desc) const {
GELOGD("LoadCustAICPUKernelBinToOpDesc in!"); GELOGD("LoadCustAICPUKernelBinToOpDesc in.");
if (op_desc != nullptr) { if (op_desc != nullptr) {
auto kernel_bin = FindKernel(op_desc->GetName()); auto kernel_bin = FindKernel(op_desc->GetName());
if (kernel_bin != nullptr) { if (kernel_bin != nullptr) {
@ -34,6 +34,6 @@ void CustAICPUKernelStore::LoadCustAICPUKernelBinToOpDesc(const std::shared_ptr<
GELOGI("Load cust aicpu kernel:%s, %zu", kernel_bin->GetName().c_str(), kernel_bin->GetBinDataSize()); GELOGI("Load cust aicpu kernel:%s, %zu", kernel_bin->GetName().c_str(), kernel_bin->GetBinDataSize());
} }
} }
GELOGD("LoadCustAICPUKernelBinToOpDesc success!"); GELOGD("LoadCustAICPUKernelBinToOpDesc success.");
} }
} // namespace ge } // namespace ge

@ -99,8 +99,8 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) {
} }
int64_t output_size = 0; int64_t output_size = 0;
if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) {
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][Param]Get output size failed, output_size:%d.", output_size); GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][Param]Get output size failed, output_size:%ld.", output_size);
REPORT_INNER_ERROR("E19999", "Get output size failed, output_size:%d.", output_size); REPORT_INNER_ERROR("E19999", "Get output size failed, output_size:%ld.", output_size);
return ACL_ERROR_GE_INTERNAL_ERROR; return ACL_ERROR_GE_INTERNAL_ERROR;
} }
GELOGD("Get output size in lanch dump op is %ld", output_size); GELOGD("Get output size in lanch dump op is %ld", output_size);
@ -127,8 +127,8 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) {
} }
int64_t input_size = 0; int64_t input_size = 0;
if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) {
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][Param]Get input size failed, input_size:%d.", input_size); GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][Param]Get input size failed, input_size:%ld.", input_size);
REPORT_INNER_ERROR("E19999", "Get input size failed, input_size:%d.", input_size); REPORT_INNER_ERROR("E19999", "Get input size failed, input_size:%ld.", input_size);
return ACL_ERROR_GE_INTERNAL_ERROR; return ACL_ERROR_GE_INTERNAL_ERROR;
} }
GELOGD("Get input size in lanch dump op is %ld", input_size); GELOGD("Get input size in lanch dump op is %ld", input_size);

@ -37,28 +37,28 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string StatusFactory::GetE
return iter_find->second; return iter_find->second;
} }
// General error code // General error code
DEF_ERRORNO(SUCCESS, "Success."); DEF_ERRORNO(SUCCESS, "Success");
DEF_ERRORNO(FAILED, "Failed."); DEF_ERRORNO(FAILED, "Failed");
// Common errocode // Common errocode
DEF_ERRORNO(MEMALLOC_FAILED, "Failed to allocate memory."); // 50331648 DEF_ERRORNO(MEMALLOC_FAILED, "Failed to allocate memory!"); // 50331648
DEF_ERRORNO(PARAM_INVALID, "Parameter's invalid."); // 50331649 DEF_ERRORNO(PARAM_INVALID, "Parameter's invalid!"); // 50331649
DEF_ERRORNO(CCE_FAILED, "Failed to call CCE API."); // 50331650 DEF_ERRORNO(CCE_FAILED, "Failed to call CCE API!"); // 50331650
DEF_ERRORNO(RT_FAILED, "Failed to call runtime API."); // 50331651 DEF_ERRORNO(RT_FAILED, "Failed to call runtime API!"); // 50331651
DEF_ERRORNO(INTERNAL_ERROR, "Internal errors."); // 50331652 DEF_ERRORNO(INTERNAL_ERROR, "Internal errors!"); // 50331652
DEF_ERRORNO(CSEC_ERROR, "Failed to call libc_sec API."); // 50331653 DEF_ERRORNO(CSEC_ERROR, "Failed to call libc_sec API!"); // 50331653
DEF_ERRORNO(TEE_ERROR, "Failed to call tee API."); // 50331653 DEF_ERRORNO(TEE_ERROR, "Failed to call tee API!"); // 50331653
DEF_ERRORNO(UNSUPPORTED, "Parameter's unsupported."); DEF_ERRORNO(UNSUPPORTED, "Parameter's unsupported!");
DEF_ERRORNO(OUT_OF_MEMORY, "Out of memory."); DEF_ERRORNO(OUT_OF_MEMORY, "Out of memory!");
// errorcode // errorcode
DEF_ERRORNO(PARSE_MODEL_FAILED, "Failed to parse the model."); DEF_ERRORNO(PARSE_MODEL_FAILED, "Failed to parse the model!");
DEF_ERRORNO(PARSE_WEIGHTS_FAILED, "Failed to parse the weights."); DEF_ERRORNO(PARSE_WEIGHTS_FAILED, "Failed to parse the weights!");
DEF_ERRORNO(NOT_INITIALIZED, "It hasn't been initialized."); DEF_ERRORNO(NOT_INITIALIZED, "It hasn't been initialized!");
DEF_ERRORNO(TIMEOUT, "Running time out."); DEF_ERRORNO(TIMEOUT, "Running time out!");
// errorcode // errorcode
DEF_ERRORNO(MODEL_NOT_READY, "The model is not ready yet."); DEF_ERRORNO(MODEL_NOT_READY, "The model is not ready yet!");
DEF_ERRORNO(PUSH_DATA_FAILED, "Failed to push data."); DEF_ERRORNO(PUSH_DATA_FAILED, "Failed to push data!");
DEF_ERRORNO(DATA_QUEUE_ISFULL, "Data queue is full."); DEF_ERRORNO(DATA_QUEUE_ISFULL, "Data queue is full!");
} // namespace domi } // namespace domi

@ -113,11 +113,11 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromArray(const v
// Get file length // Get file length
long GetFileLength(const std::string &input_file) { long GetFileLength(const std::string &input_file) {
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(input_file.empty(), return -1, "input_file path is null"); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(input_file.empty(), return -1, "input_file path is null.");
std::string real_path = RealPath(input_file.c_str()); std::string real_path = RealPath(input_file.c_str());
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), return -1, "input_file path '%s' not valid.", input_file.c_str()); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), return -1, "input_file path '%s' not valid", input_file.c_str());
unsigned long long file_length = 0; unsigned long long file_length = 0;
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(
mmGetFileSize(input_file.c_str(), &file_length) != EN_OK, mmGetFileSize(input_file.c_str(), &file_length) != EN_OK,
@ -318,7 +318,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp()
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t GetCurrentSecondTimestap() { FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t GetCurrentSecondTimestap() {
mmTimeval tv{}; mmTimeval tv{};
int ret = mmGetTimeOfDay(&tv, nullptr); int ret = mmGetTimeOfDay(&tv, nullptr);
GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed: ret=%d.", ret); GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed: ret=%d", ret);
auto total_use_time = tv.tv_sec; // seconds auto total_use_time = tv.tv_sec; // seconds
return static_cast<uint32_t>(total_use_time); return static_cast<uint32_t>(total_use_time);
} }
@ -349,7 +349,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool CheckInt64MulOverflow(int6
} }
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string RealPath(const char *path) { FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY std::string RealPath(const char *path) {
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(path == nullptr, return "", "path pointer is NULL"); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(path == nullptr, return "", "path pointer is NULL.");
GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(strlen(path) >= MMPA_MAX_PATH, GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(strlen(path) >= MMPA_MAX_PATH,
ErrorManager::GetInstance().ATCReportErrMessage("E19002", {"filepath", "size"}, ErrorManager::GetInstance().ATCReportErrMessage("E19002", {"filepath", "size"},
{path, std::to_string(MMPA_MAX_PATH)}); {path, std::to_string(MMPA_MAX_PATH)});

Loading…
Cancel
Save