【求助】openEuler调用hichain认证接口cpu占用率高
环境 openEuler 22.03 (LTS-SP1) 通过dsoftbus-1.0.0-3-oe2203sp1.aarch64.rpm包安装 软总线服务端,客户端参考示例代码调用 hichain认证,部分代码如下。发现调用InitDeviceAuthService接口后, 单核cpu占用率从 30% 升高到70%左右,调用DestroyDeviceAuthService接口后,cpu也不会降低
环境 openEuler 22.03 (LTS-SP1) 通过dsoftbus-1.0.0-3-oe2203sp1.aarch64.rpm包安装 软总线服务端,客户端参考示例代码调用 hichain认证,部分代码如下。发现调用InitDeviceAuthService接口后, 单核cpu占用率从 30% 升高到70%左右,调用DestroyDeviceAuthService接口后,cpu也不会降低,请问怎样优化,让cpu占用率降低
int HichainInit()
{
uint32_t num;
int ret;
ret = GetDevUdid(g_udid, MAX_UDID_LEN);
if (ret) {
ZLOG_ERROR("GetDevUdid fail:%d\n", ret);
return ret;
}
ret = InitDeviceAuthService();
if (ret != 0) {
ZLOG_ERROR("InitDeviceAuthService fail:%d\n", ret);
return ret;
}
g_hichainGmInstance = GetGmInstance();
if (g_hichainGmInstance == NULL) {
ZLOG_ERROR("GetGmInstance fail\n");
ret = -1;
goto err_GetGmInstance;
}
ret = HichainGmRegCallback();
if (ret != 0) {
ZLOG_ERROR("HichainGmregCallback fail.:%d\n", ret);
goto err_HichainGmRegCallback;
}
ret = HichainGmGetGroupInfo(&groupVec, &num);
if (ret != 0) {
printf("HichainGmGetGroupInfo fail:%d\n", ret);
//goto err_HichainGmGetGroupInfo;
return ret;
}
if (num == 0) {
ret = HichainGmCreatGroup();
if (ret) {
printf("HichainGmCreatGroup fail:%d\n", ret);
goto err_HichainGmCreatGroup;
}
} else {
printf("HichainGmGetGroupInfo:num=%u\n", num);
HichainSaveGroupID(groupVec);
HichainGmDestroyGroupInfo(&groupVec);
}
return 0;
err_HichainGmCreatGroup:
err_HichainGmGetGroupInfo:
HichainGmUnRegCallback();
err_HichainGmRegCallback:
err_GetGmInstance:
DestroyDeviceAuthService();
return ret;
}
更多推荐
所有评论(0)