|
|
@ -112,7 +112,6 @@ ge::Status RegProfCtrlCallback(MsprofCtrlCallback func) {
|
|
|
|
if (ge::ProfilingManager::Instance().GetMsprofCallback().msprofCtrlCallback != nullptr) {
|
|
|
|
if (ge::ProfilingManager::Instance().GetMsprofCallback().msprofCtrlCallback != nullptr) {
|
|
|
|
GELOGW("Msprof ctrl callback is exist, just ignore it.");
|
|
|
|
GELOGW("Msprof ctrl callback is exist, just ignore it.");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
GELOGI("GE register Msprof ctrl callback.");
|
|
|
|
|
|
|
|
ge::ProfilingManager::Instance().SetMsprofCtrlCallback(func);
|
|
|
|
ge::ProfilingManager::Instance().SetMsprofCtrlCallback(func);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ge::SUCCESS;
|
|
|
|
return ge::SUCCESS;
|
|
|
@ -124,7 +123,6 @@ ge::Status RegProfSetDeviceCallback(MsprofSetDeviceCallback func) {
|
|
|
|
return ge::PARAM_INVALID;
|
|
|
|
return ge::PARAM_INVALID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Pass MsprofSetDeviceCallback to runtime
|
|
|
|
// Pass MsprofSetDeviceCallback to runtime
|
|
|
|
GELOGI("GE pass setdevice callback to runtime.");
|
|
|
|
|
|
|
|
ge::Status rt_ret = rtRegDeviceStateCallback(kRtSetDeviceRegName.c_str(), static_cast<rtDeviceStateCallback>(func));
|
|
|
|
ge::Status rt_ret = rtRegDeviceStateCallback(kRtSetDeviceRegName.c_str(), static_cast<rtDeviceStateCallback>(func));
|
|
|
|
if (rt_ret != ge::SUCCESS) {
|
|
|
|
if (rt_ret != ge::SUCCESS) {
|
|
|
|
GELOGE(rt_ret, "Pass MsprofSetDeviceCallback to runtime failed!");
|
|
|
|
GELOGE(rt_ret, "Pass MsprofSetDeviceCallback to runtime failed!");
|
|
|
@ -158,7 +156,7 @@ ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t le
|
|
|
|
if (type != kProfCommandhandleFinalize) {
|
|
|
|
if (type != kProfCommandhandleFinalize) {
|
|
|
|
GE_CHECK_NOTNULL(data);
|
|
|
|
GE_CHECK_NOTNULL(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ProfCommandHandleData *prof_config_param = (ProfCommandHandleData *)data;
|
|
|
|
ProfCommandHandleData *prof_config_param = reinterpret_cast<ProfCommandHandleData *>(data);
|
|
|
|
auto iter = kProfCommandTypeMap.find(type);
|
|
|
|
auto iter = kProfCommandTypeMap.find(type);
|
|
|
|
if (iter == kProfCommandTypeMap.end()) {
|
|
|
|
if (iter == kProfCommandTypeMap.end()) {
|
|
|
|
GELOGW("The prof comand type is invalid.");
|
|
|
|
GELOGW("The prof comand type is invalid.");
|
|
|
@ -183,7 +181,8 @@ ge::Status ProfCommandHandle(ProfCommandHandleType type, void *data, uint32_t le
|
|
|
|
if (type != kProfCommandhandleFinalize) {
|
|
|
|
if (type != kProfCommandhandleFinalize) {
|
|
|
|
command.module_index = prof_config_param->profSwitch;
|
|
|
|
command.module_index = prof_config_param->profSwitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GELOGI("GE commandhandle execute, Command Type: %d, data type config: 0x%llx", type, command.module_index);
|
|
|
|
GELOGI("GE commandhandle execute, Command Type: %s, data type config: 0x%llx", iter->second.c_str(),
|
|
|
|
|
|
|
|
command.module_index);
|
|
|
|
if (type == kProfCommandhandleStart || type == kProfCommandhandleStop) {
|
|
|
|
if (type == kProfCommandhandleStart || type == kProfCommandhandleStop) {
|
|
|
|
GELOGI("Profiling device nums:%s , deviceID:[%s]", prof_params[0].c_str(), prof_params[kDeviceListIndex].c_str());
|
|
|
|
GELOGI("Profiling device nums:%s , deviceID:[%s]", prof_params[0].c_str(), prof_params[kDeviceListIndex].c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|