mirror of
https://gitee.com/openharmony/hiviewdfx_hitrace
synced 2024-11-23 07:49:43 +00:00
add hitrace ffi
Signed-off-by: zhangruixue <zhangruixue14@huawei.com>
This commit is contained in:
parent
99fb8c93f7
commit
93720b4e7e
@ -41,6 +41,7 @@
|
||||
"//base/hiviewdfx/hitrace/interfaces/native/innerkits:hitrace_meter",
|
||||
"//base/hiviewdfx/hitrace/interfaces/native/innerkits:libhitracechain",
|
||||
"//base/hiviewdfx/hitrace/interfaces/js/kits:hitrace_napi",
|
||||
"//base/hiviewdfx/hitrace/interfaces/cj/kits:hitrace_ffi",
|
||||
"//base/hiviewdfx/hitrace/interfaces/rust/innerkits/hitracechain:hitracechain_rust",
|
||||
"//base/hiviewdfx/hitrace/interfaces/rust/innerkits/hitrace_meter:hitrace_meter_rust",
|
||||
"//base/hiviewdfx/hitrace/frameworks/hitrace_ndk:hitrace_ndk"
|
||||
|
75
interfaces/cj/kits/BUILD.gn
Normal file
75
interfaces/cj/kits/BUILD.gn
Normal file
@ -0,0 +1,75 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
|
||||
group("hitrace_ffi") {
|
||||
deps = []
|
||||
if (support_jsapi) {
|
||||
deps += [
|
||||
":cj_hitracechain_ffi",
|
||||
":cj_hitracemeter_ffi",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_shared_library("cj_hitracechain_ffi") {
|
||||
include_dirs = [
|
||||
"include/",
|
||||
"../../../interfaces/native/innerkits/include/hitrace",
|
||||
"../../frameworks/include",
|
||||
]
|
||||
|
||||
configs = []
|
||||
|
||||
sources = [
|
||||
"./src/hitracechain_ffi.cpp",
|
||||
"./src/hitracechain_impl.cpp",
|
||||
]
|
||||
|
||||
deps = [ "../../native/innerkits:libhitracechain" ]
|
||||
|
||||
external_deps = []
|
||||
external_deps += [
|
||||
"napi:ace_napi",
|
||||
"napi:cj_bind_ffi",
|
||||
]
|
||||
|
||||
innerapi_tags = [ "platformsdk" ]
|
||||
|
||||
part_name = "hitrace"
|
||||
|
||||
subsystem_name = "hiviewdfx"
|
||||
}
|
||||
|
||||
ohos_shared_library("cj_hitracemeter_ffi") {
|
||||
include_dirs = [
|
||||
"include/",
|
||||
"../../frameworks/include",
|
||||
]
|
||||
sources = [
|
||||
"./src/hitracemeter_ffi.cpp",
|
||||
"./src/hitracemeter_impl.cpp",
|
||||
]
|
||||
deps = [ "../../native/innerkits:hitrace_meter" ]
|
||||
external_deps = []
|
||||
external_deps += [
|
||||
"napi:ace_napi",
|
||||
"napi:cj_bind_ffi",
|
||||
]
|
||||
|
||||
innerapi_tags = [ "platformsdk" ]
|
||||
|
||||
subsystem_name = "hiviewdfx"
|
||||
part_name = "hitrace"
|
||||
}
|
62
interfaces/cj/kits/include/hitracechain_ffi.h
Normal file
62
interfaces/cj/kits/include/hitracechain_ffi.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef HITRACECHAIN_FFI_H
|
||||
#define HITRACECHAIN_FFI_H
|
||||
|
||||
#include "hitraceid.h"
|
||||
#include <cstdint>
|
||||
|
||||
extern "C" {
|
||||
struct CHiTraceId {
|
||||
int64_t chainId;
|
||||
int32_t spanId;
|
||||
int32_t parentSpanId;
|
||||
int32_t flags;
|
||||
};
|
||||
|
||||
static CHiTraceId Parse(OHOS::HiviewDFX::HiTraceId id)
|
||||
{
|
||||
CHiTraceId traceId;
|
||||
traceId.chainId = id.GetChainId();
|
||||
traceId.spanId = id.GetSpanId();
|
||||
traceId.parentSpanId = id.GetParentSpanId();
|
||||
traceId.flags = id.GetFlags();
|
||||
return traceId;
|
||||
}
|
||||
|
||||
static OHOS::HiviewDFX::HiTraceId Parse(CHiTraceId id)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId traceId;
|
||||
traceId.SetChainId(id.chainId);
|
||||
traceId.SetSpanId(id.spanId);
|
||||
traceId.SetParentSpanId(id.parentSpanId);
|
||||
traceId.SetFlags(id.flags);
|
||||
return traceId;
|
||||
}
|
||||
|
||||
CHiTraceId FfiOHOSHiTraceChainBegin(const char* name, int32_t flag);
|
||||
void FfiOHOSHiTraceChainEnd(CHiTraceId id);
|
||||
CHiTraceId FfiOHOSHiTraceChainGetId();
|
||||
void FfiOHOSHiTraceChainSetId(CHiTraceId id);
|
||||
void FfiOHOSHiTraceChainClearId();
|
||||
CHiTraceId FfiOHOSHiTraceChainCreateSpan();
|
||||
void FfiOHOSHiTraceChainTracepoint(uint32_t mode, uint32_t type, CHiTraceId id, const char* str);
|
||||
bool FfiOHOSHiTraceChainIsValid(CHiTraceId id);
|
||||
bool FfiOHOSHiTraceChainIsFlagEnabled(CHiTraceId id, int32_t flag);
|
||||
void FfiOHOSHiTraceChainEnableFlag(CHiTraceId id, int32_t flag);
|
||||
}
|
||||
|
||||
#endif
|
41
interfaces/cj/kits/include/hitracechain_impl.h
Normal file
41
interfaces/cj/kits/include/hitracechain_impl.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef HITRACECHAIN_IMPL_H
|
||||
#define HITRACECHAIN_IMPL_H
|
||||
|
||||
#include "tracechain.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace CJSystemapi {
|
||||
|
||||
class HiTraceChainImpl {
|
||||
public:
|
||||
static HiviewDFX::HiTraceId Begin(const char* name, int taskId);
|
||||
static void End(const HiviewDFX::HiTraceId& id);
|
||||
static HiviewDFX::HiTraceId GetId();
|
||||
static void SetId(const HiviewDFX::HiTraceId& id);
|
||||
static void ClearId();
|
||||
static HiviewDFX::HiTraceId CreateSpan();
|
||||
static void Tracepoint(uint32_t mode, uint32_t type, HiviewDFX::HiTraceId id, const char* fmt);
|
||||
static bool IsValid(const HiviewDFX::HiTraceId& id);
|
||||
static bool IsFlagEnabled(const HiviewDFX::HiTraceId& traceId, int32_t flag);
|
||||
static void EnableFlag(const HiviewDFX::HiTraceId& traceId, int32_t flag);
|
||||
};
|
||||
|
||||
} // CJSystemapi
|
||||
} // OHOS
|
||||
|
||||
#endif
|
28
interfaces/cj/kits/include/hitracemeter_ffi.h
Normal file
28
interfaces/cj/kits/include/hitracemeter_ffi.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef HITRACEMETER_FFI_H
|
||||
#define HITRACEMETER_FFI_H
|
||||
|
||||
#include "cj_ffi/cj_common_ffi.h"
|
||||
#include <cstdint>
|
||||
|
||||
extern "C" {
|
||||
void FfiOHOSHiTraceStartAsyncTrace(const char* name, int taskId);
|
||||
void FfiOHOSHiTraceFinishAsyncTrace(const char* name, int taskId);
|
||||
void FfiOHOSHiTraceCountTrace(const char* name, int taskId);
|
||||
}
|
||||
|
||||
#endif
|
35
interfaces/cj/kits/include/hitracemeter_impl.h
Normal file
35
interfaces/cj/kits/include/hitracemeter_impl.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef HITRACEMETER_IMPL_H
|
||||
#define HITRACEMETER_IMPL_H
|
||||
|
||||
#include <cstdint>
|
||||
namespace OHOS {
|
||||
namespace CJSystemapi {
|
||||
|
||||
constexpr uint64_t HITRACE_TAG_APP = (1ULL << 62); // App tag
|
||||
|
||||
class HiTraceMeterImpl {
|
||||
public:
|
||||
static void HiTraceStartAsyncTrace(const char* name, int taskId);
|
||||
static void HiTraceFinishAsyncTrace(const char* name, int taskId);
|
||||
static void HiTraceCountTrace(const char* name, int count);
|
||||
};
|
||||
|
||||
} // CJSystemapi
|
||||
} // OHOS
|
||||
|
||||
#endif
|
81
interfaces/cj/kits/src/hitracechain_ffi.cpp
Normal file
81
interfaces/cj/kits/src/hitracechain_ffi.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"){
|
||||
}
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hitracechain_ffi.h"
|
||||
#include "hitracechain_impl.h"
|
||||
|
||||
using namespace OHOS::CJSystemapi;
|
||||
|
||||
extern "C" {
|
||||
CHiTraceId FfiOHOSHiTraceChainBegin(const char* name, int flag)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId id = HiTraceChainImpl::Begin(name, flag);
|
||||
return Parse(id);
|
||||
}
|
||||
|
||||
void FfiOHOSHiTraceChainEnd(CHiTraceId id)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId traceId = Parse(id);
|
||||
HiTraceChainImpl::End(traceId);
|
||||
}
|
||||
|
||||
CHiTraceId FfiOHOSHiTraceChainGetId()
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId id = HiTraceChainImpl::GetId();
|
||||
return Parse(id);
|
||||
}
|
||||
|
||||
void FfiOHOSHiTraceChainSetId(CHiTraceId id)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId traceId = Parse(id);
|
||||
HiTraceChainImpl::SetId(traceId);
|
||||
}
|
||||
|
||||
void FfiOHOSHiTraceChainClearId()
|
||||
{
|
||||
HiTraceChainImpl::ClearId();
|
||||
}
|
||||
|
||||
CHiTraceId FfiOHOSHiTraceChainCreateSpan()
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId id = HiTraceChainImpl::CreateSpan();
|
||||
return Parse(id);
|
||||
}
|
||||
|
||||
void FfiOHOSHiTraceChainTracepoint(uint32_t mode, uint32_t type, CHiTraceId id, const char* str)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId traceId = Parse(id);
|
||||
HiTraceChainImpl::Tracepoint(mode, type, traceId, str);
|
||||
}
|
||||
|
||||
bool FfiOHOSHiTraceChainIsValid(CHiTraceId id)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId traceId = Parse(id);
|
||||
return HiTraceChainImpl::IsValid(traceId);
|
||||
}
|
||||
|
||||
bool FfiOHOSHiTraceChainIsFlagEnabled(CHiTraceId id, int32_t flag)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId traceId = Parse(id);
|
||||
return HiTraceChainImpl::IsFlagEnabled(traceId, flag);
|
||||
}
|
||||
|
||||
void FfiOHOSHiTraceChainEnableFlag(CHiTraceId id, int32_t flag)
|
||||
{
|
||||
OHOS::HiviewDFX::HiTraceId traceId = Parse(id);
|
||||
return HiTraceChainImpl::EnableFlag(traceId, flag);
|
||||
}
|
||||
}
|
81
interfaces/cj/kits/src/hitracechain_impl.cpp
Normal file
81
interfaces/cj/kits/src/hitracechain_impl.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hitracechain_impl.h"
|
||||
#include <string>
|
||||
|
||||
using namespace OHOS::HiviewDFX;
|
||||
|
||||
namespace OHOS {
|
||||
namespace CJSystemapi {
|
||||
|
||||
HiTraceId HiTraceChainImpl::Begin(const char* name, int flags)
|
||||
{
|
||||
return HiTraceChain::Begin(std::string(name), flags);
|
||||
}
|
||||
|
||||
void HiTraceChainImpl::End(const HiTraceId& id)
|
||||
{
|
||||
return HiTraceChain::End(id);
|
||||
}
|
||||
|
||||
HiTraceId HiTraceChainImpl::GetId()
|
||||
{
|
||||
return HiTraceChain::GetId();
|
||||
}
|
||||
|
||||
void HiTraceChainImpl::SetId(const HiTraceId& id)
|
||||
{
|
||||
return HiTraceChain::SetId(id);
|
||||
}
|
||||
|
||||
void HiTraceChainImpl::ClearId()
|
||||
{
|
||||
return HiTraceChain::ClearId();
|
||||
}
|
||||
|
||||
HiTraceId HiTraceChainImpl::CreateSpan()
|
||||
{
|
||||
return HiTraceChain::CreateSpan();
|
||||
}
|
||||
|
||||
void HiTraceChainImpl::Tracepoint(uint32_t mode, uint32_t type, HiTraceId id, const char* fmt)
|
||||
{
|
||||
HiTraceCommunicationMode communicationMode = HiTraceCommunicationMode(mode);
|
||||
HiTraceTracepointType tracePointType = HiTraceTracepointType(type);
|
||||
return HiTraceChain::Tracepoint(communicationMode, tracePointType, id, "%s", fmt);
|
||||
}
|
||||
|
||||
bool HiTraceChainImpl::IsValid(const HiTraceId& id)
|
||||
{
|
||||
return id.IsValid();
|
||||
}
|
||||
|
||||
bool HiTraceChainImpl::IsFlagEnabled(const HiTraceId& traceId, int32_t flag)
|
||||
{
|
||||
HiTraceFlag traceFlag = HiTraceFlag(flag);
|
||||
bool isFalgEnabled = traceId.IsFlagEnabled(traceFlag);
|
||||
return isFalgEnabled;
|
||||
}
|
||||
|
||||
void HiTraceChainImpl::EnableFlag(const HiTraceId& traceId, int32_t flag)
|
||||
{
|
||||
HiTraceFlag traceFlag = HiTraceFlag(flag);
|
||||
traceId.IsFlagEnabled(traceFlag);
|
||||
}
|
||||
|
||||
} // CJSystemapi
|
||||
} // OHOS
|
||||
|
29
interfaces/cj/kits/src/hitracechain_mock.cpp
Normal file
29
interfaces/cj/kits/src/hitracechain_mock.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "cj_ffi/cj_common_ffi.h"
|
||||
|
||||
extern "C" {
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainBegin = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainEnd = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainGetId = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainSetId = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainClearId = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainCreateSpan = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainTracepoint = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainIsValid = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainIsFlagEnabled = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceChainEnableFlag = 0;
|
||||
}
|
36
interfaces/cj/kits/src/hitracemeter_ffi.cpp
Normal file
36
interfaces/cj/kits/src/hitracemeter_ffi.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hitracemeter_ffi.h"
|
||||
#include "hitracemeter_impl.h"
|
||||
|
||||
using namespace OHOS::CJSystemapi;
|
||||
|
||||
extern "C" {
|
||||
void FfiOHOSHiTraceStartAsyncTrace(const char* name, int taskId)
|
||||
{
|
||||
HiTraceMeterImpl::HiTraceStartAsyncTrace(name, taskId);
|
||||
}
|
||||
|
||||
void FfiOHOSHiTraceFinishAsyncTrace(const char* name, int taskId)
|
||||
{
|
||||
HiTraceMeterImpl::HiTraceFinishAsyncTrace(name, taskId);
|
||||
}
|
||||
|
||||
void FfiOHOSHiTraceCountTrace(const char* name, int count)
|
||||
{
|
||||
HiTraceMeterImpl::HiTraceCountTrace(name, count);
|
||||
}
|
||||
}
|
39
interfaces/cj/kits/src/hitracemeter_impl.cpp
Normal file
39
interfaces/cj/kits/src/hitracemeter_impl.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hitracemeter_impl.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include <string>
|
||||
|
||||
namespace OHOS {
|
||||
namespace CJSystemapi {
|
||||
|
||||
void HiTraceMeterImpl::HiTraceStartAsyncTrace(const char* name, int taskId)
|
||||
{
|
||||
StartAsyncTrace(HITRACE_TAG_APP, std::string(name), taskId);
|
||||
}
|
||||
|
||||
void HiTraceMeterImpl::HiTraceFinishAsyncTrace(const char* name, int taskId)
|
||||
{
|
||||
FinishAsyncTrace(HITRACE_TAG_APP, std::string(name), taskId);
|
||||
}
|
||||
|
||||
void HiTraceMeterImpl::HiTraceCountTrace(const char* name, int count)
|
||||
{
|
||||
CountTrace(HITRACE_TAG_APP, std::string(name), count);
|
||||
}
|
||||
|
||||
} // CJSystemapi
|
||||
} // OHOS
|
22
interfaces/cj/kits/src/hitracemeter_mock.cpp
Normal file
22
interfaces/cj/kits/src/hitracemeter_mock.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "cj_ffi/cj_common_ffi.h"
|
||||
|
||||
extern "C" {
|
||||
FFI_EXPORT int FfiOHOSHiTraceStartAsyncTrace = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceFinishAsyncTrace = 0;
|
||||
FFI_EXPORT int FfiOHOSHiTraceCountTrace = 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user