add XCollie

Signed-off-by: lvshuai <lvshuai11@h-partners.com>
Change-Id: I7a0172079d25c415cf3866008ec096beaceda74f
This commit is contained in:
lvshuai 2024-06-25 08:50:25 +00:00
parent 57777ed78a
commit 8cafd77723
2 changed files with 3 additions and 3 deletions

View File

@ -31,14 +31,12 @@ XCollieHelper::XCollieHelper(const std::string &name, unsigned int timeout)
{
id_ = HiviewDFX::XCollie::GetInstance()
.SetTimer(name_, timeout_, nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_DEFAULT);
IAM_LOGI("start XCollie, name:%{public}s, timeout:%{public}u", name_.c_str(), timeout_);
}
XCollieHelper::~XCollieHelper()
{
IAM_LOGI("cancel XCollie, name:%{public}s", name_.c_str());
HiviewDFX::XCollie::GetInstance().CancelTimer(id_);
}
} // namespace Common
} // namespace UserIam
} // namespace UserIam
} // namespace OHOS

View File

@ -22,10 +22,12 @@ namespace OHOS {
namespace UserIam {
namespace Common {
constexpr unsigned int API_CALL_TIMEOUT = 5; // 5s
class XCollieHelper {
public:
XCollieHelper(const std::string &name, unsigned int timeout);
~XCollieHelper();
private:
int id_;
const std::string name_;