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 #include "hitrace_meter.h"
18
19 namespace OHOS {
20 namespace MiscServices {
InitHiTrace()21 void InitHiTrace()
22 {
23 UpdateTraceLabel();
24 }
25
ValueTrace(const std::string & name,int64_t count)26 void ValueTrace(const std::string &name, int64_t count)
27 {
28 CountTrace(HITRACE_TAG_MISC, name, count);
29 }
30
StartAsync(uint64_t label,const std::string & value,int32_t taskId)31 void StartAsync(uint64_t label, const std::string& value, int32_t taskId)
32 {
33 StartAsyncTrace(label, value, taskId);
34 }
35
FinishAsync(uint64_t label,const std::string & value,int32_t taskId)36 void FinishAsync(uint64_t label, const std::string &value, int32_t taskId)
37 {
38 FinishAsyncTrace(label, value, taskId);
39 }
40
InputmethodTrace(const std::string & value)41 InputmethodTrace::InputmethodTrace(const std::string &value)
42 {
43 StartTrace(HITRACE_TAG_MISC, value);
44 }
45
~InputmethodTrace()46 InputmethodTrace::~InputmethodTrace()
47 {
48 FinishTrace(HITRACE_TAG_MISC);
49 }
50 } // namespace MiscServices
51 } // namespace OHOS