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