1/* 2 * Copyright (c) 2022-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "inputmethod_trace.h" 17 18#include "hitrace_meter.h" 19 20namespace OHOS { 21namespace MiscServices { 22constexpr uint64_t HITRACE_TAG_MISC = (1ULL << 41); // Notification module tag. 23void InitHiTrace() 24{ 25 UpdateTraceLabel(); 26} 27 28void ValueTrace(const std::string &name, int64_t count) 29{ 30 CountTrace(HITRACE_TAG_MISC, name, count); 31} 32 33void StartAsync(const std::string &value, int32_t taskId) 34{ 35 StartAsyncTrace(HITRACE_TAG_MISC, value, taskId); 36} 37 38void FinishAsync(const std::string &value, int32_t taskId) 39{ 40 FinishAsyncTrace(HITRACE_TAG_MISC, value, taskId); 41} 42 43InputMethodSyncTrace::InputMethodSyncTrace(const std::string &value) 44{ 45 StartTrace(HITRACE_TAG_MISC, value); 46} 47 48InputMethodSyncTrace::InputMethodSyncTrace(const std::string &value, const std::string &id) 49{ 50 auto info = value + "_" + id; 51 StartTrace(HITRACE_TAG_MISC, info); 52} 53 54InputMethodSyncTrace::~InputMethodSyncTrace() 55{ 56 FinishTrace(HITRACE_TAG_MISC); 57} 58} // namespace MiscServices 59} // namespace OHOS