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 #ifndef OHOS_LITE
16 #include "foundation/utils/hitrace_utils.h"
17 
18 namespace OHOS {
19 namespace Media {
SyncTracker(const std::string & title)20     SyncTracker::SyncTracker(const std::string &title)
21     {
22         StartTrace(DEFAULT_HITRACE_TAG, title, DEFAULT_HITRACE_LIMIT);
23     }
24 
~SyncTracker()25     SyncTracker::~SyncTracker()
26     {
27         FinishTrace(DEFAULT_HITRACE_TAG);
28     }
29 
AsyncTracker(const std::string & title,int32_t taskId)30     AsyncTracker::AsyncTracker(const std::string &title, int32_t taskId)
31         :title_(title), taskId_(taskId)
32     {
33         StartAsyncTrace(DEFAULT_HITRACE_TAG, title, taskId, DEFAULT_HITRACE_LIMIT);
34     }
35 
~AsyncTracker()36     AsyncTracker::~AsyncTracker()
37     {
38         FinishAsyncTrace(DEFAULT_HITRACE_TAG, title_, taskId_);
39     }
40 }
41 }
42 #endif