From 6a40f67e7cb56c491bec6089b940ad35f6594aea Mon Sep 17 00:00:00 2001
From: muyuying1 <muyuying1@huawei.com>
Date: Thu, 3 Aug 2023 17:01:05 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A3=81=E5=89=AAhitrace=E5=92=8Chisysevent?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 frameworks/common/dds_trace.h                 | 115 +++++++++---------
 .../src/distributed_kv_data_manager.cpp       |  26 ++--
 .../src/kvstore_sync_callback_client.cpp      |   2 +-
 .../kvdb/src/single_store_impl.cpp            |  62 +++++-----
 .../common/src/db_dfx_adapter.cpp             |   4 +-
 5 files changed, 105 insertions(+), 104 deletions(-)

diff --git a/frameworks/common/dds_trace.h b/frameworks/common/dds_trace.h
index a80b19d..2370a19 100644
--- a/frameworks/common/dds_trace.h
+++ b/frameworks/common/dds_trace.h
@@ -16,13 +16,13 @@
 #ifndef DDS_TRACE_H
 #define DDS_TRACE_H
 
-#include <atomic>
-#include <cinttypes>
-#include <string>
-#include <functional>
-#include <chrono>
-#include "hitrace/trace.h"
-#include "hitrace_meter.h"
+// #include <atomic>
+// #include <cinttypes>
+// #include <string>
+// #include <functional>
+// #include <chrono>
+// // #include "hitrace/trace.h"
+// // #include "hitrace_meter.h"
 namespace OHOS {
 namespace DistributedDataDfx {
 enum TraceSwitch {
@@ -31,58 +31,59 @@ enum TraceSwitch {
     API_PERFORMANCE_TRACE_ON = 0x02,
     TRACE_CHAIN_ON = 0x04,
 };
-class __attribute__((visibility("hidden"))) DdsTrace {
-public:
-    using Action = std::function<void(const std::string &value, uint64_t delta)>;
-    using System = std::chrono::system_clock;
-    DdsTrace(const std::string &value, unsigned int option = BYTRACE_ON, Action action = nullptr)
-    {
-        traceSwitch_ = option;
-        traceValue_ = value;
-        action_ = action;
-        static std::atomic_bool enable = false;
-        if (!enable.exchange(true)) {
-            UpdateTraceLabel();
-        }
-        Start(value);
-    }
+// class __attribute__((visibility("hidden"))) DdsTrace {
+// public:
+//     using Action = std::function<void(const std::string &value, uint64_t delta)>;
+//     using System = std::chrono::system_clock;
+//     DdsTrace(const std::string &value, unsigned int option = BYTRACE_ON, Action action = nullptr)
+//     {
+//         traceSwitch_ = option;
+//         traceValue_ = value;
+//         action_ = action;
+//         static std::atomic_bool enable = false;
+//         // if (!enable.exchange(true)) {
+//         //     UpdateTraceLabel();
+//         // }
+//         Start(value);
+//     }
 
-    ~DdsTrace()
-    {
-        Finish(traceValue_);
-    }
+//     ~DdsTrace()
+//     {
+//         Finish(traceValue_);
+//     }
 
-private:
-    void Start(const std::string &value)
-    {
-        if ((traceSwitch_ & BYTRACE_ON) == BYTRACE_ON) {
-            StartTrace(HITRACE_TAG_DISTRIBUTEDDATA, value);
-        }
-        if ((traceSwitch_ & TRACE_CHAIN_ON) == TRACE_CHAIN_ON) {
-            traceId_ = OHOS::HiviewDFX::HiTraceChain::Begin(value, HITRACE_FLAG_DEFAULT);
-        }
-        if ((traceSwitch_ & API_PERFORMANCE_TRACE_ON) == API_PERFORMANCE_TRACE_ON) {
-            lastTime_ = System::now();
-        }
-    }
-    void Finish(const std::string &value)
-    {
-        if ((traceSwitch_ & BYTRACE_ON) == BYTRACE_ON) {
-            FinishTrace(HITRACE_TAG_DISTRIBUTEDDATA);
-        }
-        if ((traceSwitch_ & TRACE_CHAIN_ON) == TRACE_CHAIN_ON) {
-            OHOS::HiviewDFX::HiTraceChain::End(traceId_);
-        }
-        if ((traceSwitch_ & API_PERFORMANCE_TRACE_ON) == API_PERFORMANCE_TRACE_ON && action_) {
-            action_(value, std::chrono::duration_cast<std::chrono::milliseconds>(System::now() - lastTime_).count());
-        }
-    }
-    Action action_;
-    std::string traceValue_{ };
-    HiviewDFX::HiTraceId traceId_;
-    uint32_t traceSwitch_{ 0 };
-    System::time_point lastTime_;
-};
+// private:
+//     void Start(const std::string &value)
+//     {
+//         // if ((traceSwitch_ & BYTRACE_ON) == BYTRACE_ON) {
+//         //     StartTrace(HITRACE_TAG_DISTRIBUTEDDATA, value);
+//         // }
+//         // if ((traceSwitch_ & TRACE_CHAIN_ON) == TRACE_CHAIN_ON) {
+//         //     traceId_ = OHOS::HiviewDFX::HiTraceChain::Begin(value, HITRACE_FLAG_DEFAULT);
+//         // }
+//         if ((traceSwitch_ & API_PERFORMANCE_TRACE_ON) == API_PERFORMANCE_TRACE_ON) {
+//             lastTime_ = System::now();
+//         }
+//     }
+//     void Finish(const std::string &value)
+//     {
+//         // if ((traceSwitch_ & BYTRACE_ON) == BYTRACE_ON) {
+//         //     FinishTrace(HITRACE_TAG_DISTRIBUTEDDATA);
+//         // }
+//         // if ((traceSwitch_ & TRACE_CHAIN_ON) == TRACE_CHAIN_ON) {
+//         //     OHOS::HiviewDFX::HiTraceChain::End(traceId_);
+//         // }
+//         if ((traceSwitch_ & API_PERFORMANCE_TRACE_ON) == API_PERFORMANCE_TRACE_ON && action_) {
+//             action_(value, std::chrono::duration_cast<std::chrono::milliseconds>(System::now() - lastTime_).count());
+//         }
+//     }
+//     Action action_;
+//     std::string traceValue_{ };
+//     // HiviewDFX::HiTraceId traceId_;
+//     uint32_t traceSwitch_{ 0 };
+//     System::time_point lastTime_;
+// };
 } // namespace DistributedDataDfx
 } // namespace OHOS
+
 #endif
diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp
index 73e0fb3..85faa27 100644
--- a/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp
+++ b/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp
@@ -36,8 +36,8 @@ DistributedKvDataManager::~DistributedKvDataManager()
 Status DistributedKvDataManager::GetSingleKvStore(const Options &options, const AppId &appId, const StoreId &storeId,
                                                   std::shared_ptr<SingleKvStore> &singleKvStore)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
-        TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
+        // TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
 
     singleKvStore = nullptr;
     if (!storeId.IsValid()) {
@@ -57,7 +57,7 @@ Status DistributedKvDataManager::GetSingleKvStore(const Options &options, const
 
 Status DistributedKvDataManager::GetAllKvStoreId(const AppId &appId, std::vector<StoreId> &storeIds)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
 
     KvStoreServiceDeathNotifier::SetAppId(appId);
     return StoreManager::GetInstance().GetStoreIds(appId, storeIds);
@@ -65,8 +65,8 @@ Status DistributedKvDataManager::GetAllKvStoreId(const AppId &appId, std::vector
 
 Status DistributedKvDataManager::CloseKvStore(const AppId &appId, const StoreId &storeId)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
-        TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
+        // TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
 
     KvStoreServiceDeathNotifier::SetAppId(appId);
     if (!storeId.IsValid()) {
@@ -79,8 +79,8 @@ Status DistributedKvDataManager::CloseKvStore(const AppId &appId, const StoreId
 
 Status DistributedKvDataManager::CloseKvStore(const AppId &appId, std::shared_ptr<SingleKvStore> &kvStorePtr)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
-        TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
+        // TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
 
     if (kvStorePtr == nullptr) {
         ZLOGE("kvStorePtr is nullptr.");
@@ -95,8 +95,8 @@ Status DistributedKvDataManager::CloseKvStore(const AppId &appId, std::shared_pt
 
 Status DistributedKvDataManager::CloseAllKvStore(const AppId &appId)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
-        TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
+        // TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
 
     KvStoreServiceDeathNotifier::SetAppId(appId);
     return StoreManager::GetInstance().CloseAllKVStore(appId);
@@ -104,8 +104,8 @@ Status DistributedKvDataManager::CloseAllKvStore(const AppId &appId)
 
 Status DistributedKvDataManager::DeleteKvStore(const AppId &appId, const StoreId &storeId, const std::string &path)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
-        TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
+        // TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
 
     if (!storeId.IsValid()) {
         ZLOGE("invalid storeId.");
@@ -122,8 +122,8 @@ Status DistributedKvDataManager::DeleteKvStore(const AppId &appId, const StoreId
 
 Status DistributedKvDataManager::DeleteAllKvStore(const AppId &appId, const std::string &path)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
-        TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__),
+        // TraceSwitch::BYTRACE_ON | TraceSwitch::TRACE_CHAIN_ON);
     if (path.empty()) {
         ZLOGE("path empty");
         return Status::INVALID_ARGUMENT;
diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp
index 5e70f0d..75b7846 100644
--- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp
+++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_sync_callback_client.cpp
@@ -31,7 +31,7 @@ KvStoreSyncCallbackClient::~KvStoreSyncCallbackClient()
 
 void KvStoreSyncCallbackClient::SyncCompleted(const std::map<std::string, Status> &results, uint64_t sequenceId)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), TraceSwitch::BYTRACE_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), TraceSwitch::BYTRACE_ON);
     auto finded = syncCallbackInfo_.Find(sequenceId);
     if (finded.first) {
         finded.second->SyncCompleted(results);
diff --git a/frameworks/innerkitsimpl/kvdb/src/single_store_impl.cpp b/frameworks/innerkitsimpl/kvdb/src/single_store_impl.cpp
index a82529f..6826238 100644
--- a/frameworks/innerkitsimpl/kvdb/src/single_store_impl.cpp
+++ b/frameworks/innerkitsimpl/kvdb/src/single_store_impl.cpp
@@ -64,7 +64,7 @@ StoreId SingleStoreImpl::GetStoreId() const
 
 Status SingleStoreImpl::Put(const Key &key, const Value &value)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -90,7 +90,7 @@ Status SingleStoreImpl::Put(const Key &key, const Value &value)
 
 Status SingleStoreImpl::PutBatch(const std::vector<Entry> &entries)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -120,7 +120,7 @@ Status SingleStoreImpl::PutBatch(const std::vector<Entry> &entries)
 
 Status SingleStoreImpl::Delete(const Key &key)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -144,7 +144,7 @@ Status SingleStoreImpl::Delete(const Key &key)
 
 Status SingleStoreImpl::DeleteBatch(const std::vector<Key> &keys)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -172,7 +172,7 @@ Status SingleStoreImpl::DeleteBatch(const std::vector<Key> &keys)
 
 Status SingleStoreImpl::StartTransaction()
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -189,7 +189,7 @@ Status SingleStoreImpl::StartTransaction()
 
 Status SingleStoreImpl::Commit()
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -206,7 +206,7 @@ Status SingleStoreImpl::Commit()
 
 Status SingleStoreImpl::Rollback()
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -223,7 +223,7 @@ Status SingleStoreImpl::Rollback()
 
 Status SingleStoreImpl::SubscribeKvStore(SubscribeType type, std::shared_ptr<Observer> observer)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -262,7 +262,7 @@ Status SingleStoreImpl::SubscribeKvStore(SubscribeType type, std::shared_ptr<Obs
 
 Status SingleStoreImpl::UnSubscribeKvStore(SubscribeType type, std::shared_ptr<Observer> observer)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -300,7 +300,7 @@ Status SingleStoreImpl::UnSubscribeKvStore(SubscribeType type, std::shared_ptr<O
 
 Status SingleStoreImpl::Get(const Key &key, Value &value)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -325,7 +325,7 @@ Status SingleStoreImpl::Get(const Key &key, Value &value)
 
 Status SingleStoreImpl::GetEntries(const Key &prefix, std::vector<Entry> &entries) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     DBKey dbPrefix = convertor_.GetPrefix(prefix);
     if (dbPrefix.empty() && !prefix.Empty()) {
         ZLOGE("invalid prefix:%{public}s size:%{public}zu", StoreUtil::Anonymous(prefix.ToString()).c_str(),
@@ -344,7 +344,7 @@ Status SingleStoreImpl::GetEntries(const Key &prefix, std::vector<Entry> &entrie
 
 Status SingleStoreImpl::GetEntries(const DataQuery &query, std::vector<Entry> &entries) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     DBQuery dbQuery = convertor_.GetDBQuery(query);
     auto status = GetEntries(dbQuery, entries);
     if (status != SUCCESS) {
@@ -355,7 +355,7 @@ Status SingleStoreImpl::GetEntries(const DataQuery &query, std::vector<Entry> &e
 
 Status SingleStoreImpl::GetResultSet(const Key &prefix, std::shared_ptr<ResultSet> &resultSet) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     DBKey dbPrefix = convertor_.GetPrefix(prefix);
     if (dbPrefix.empty() && !prefix.Empty()) {
         ZLOGE("invalid prefix:%{public}s size:%{public}zu", StoreUtil::Anonymous(prefix.ToString()).c_str(),
@@ -374,7 +374,7 @@ Status SingleStoreImpl::GetResultSet(const Key &prefix, std::shared_ptr<ResultSe
 
 Status SingleStoreImpl::GetResultSet(const DataQuery &query, std::shared_ptr<ResultSet> &resultSet) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     DBQuery dbQuery = convertor_.GetDBQuery(query);
     auto status = GetResultSet(dbQuery, resultSet);
     if (status != SUCCESS) {
@@ -385,7 +385,7 @@ Status SingleStoreImpl::GetResultSet(const DataQuery &query, std::shared_ptr<Res
 
 Status SingleStoreImpl::CloseResultSet(std::shared_ptr<ResultSet> &resultSet)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     if (resultSet == nullptr) {
         ZLOGE("input is nullptr");
         return INVALID_ARGUMENT;
@@ -401,7 +401,7 @@ Status SingleStoreImpl::CloseResultSet(std::shared_ptr<ResultSet> &resultSet)
 
 Status SingleStoreImpl::GetCount(const DataQuery &query, int &result) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -419,7 +419,7 @@ Status SingleStoreImpl::GetCount(const DataQuery &query, int &result) const
 
 Status SingleStoreImpl::GetSecurityLevel(SecurityLevel &secLevel) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -438,7 +438,7 @@ Status SingleStoreImpl::GetSecurityLevel(SecurityLevel &secLevel) const
 
 Status SingleStoreImpl::RemoveDeviceData(const std::string &device)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     std::shared_lock<decltype(rwMutex_)> lock(rwMutex_);
     if (dbStore_ == nullptr) {
         ZLOGE("db:%{public}s already closed!", storeId_.c_str());
@@ -464,7 +464,7 @@ Status SingleStoreImpl::RemoveDeviceData(const std::string &device)
 
 Status SingleStoreImpl::Sync(const std::vector<std::string> &devices, SyncMode mode, uint32_t delay)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     KVDBService::SyncInfo syncInfo;
     syncInfo.seqId = StoreUtil::GenSequenceId();
     syncInfo.mode = mode;
@@ -476,7 +476,7 @@ Status SingleStoreImpl::Sync(const std::vector<std::string> &devices, SyncMode m
 Status SingleStoreImpl::Sync(const std::vector<std::string> &devices, SyncMode mode, const DataQuery &query,
     std::shared_ptr<SyncCallback> syncCallback)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     KVDBService::SyncInfo syncInfo;
     syncInfo.seqId = StoreUtil::GenSequenceId();
     syncInfo.mode = mode;
@@ -487,7 +487,7 @@ Status SingleStoreImpl::Sync(const std::vector<std::string> &devices, SyncMode m
 
 Status SingleStoreImpl::RegisterSyncCallback(std::shared_ptr<SyncCallback> callback)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), TraceSwitch::BYTRACE_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), TraceSwitch::BYTRACE_ON);
     if (callback == nullptr) {
         ZLOGW("INVALID_ARGUMENT.");
         return INVALID_ARGUMENT;
@@ -498,14 +498,14 @@ Status SingleStoreImpl::RegisterSyncCallback(std::shared_ptr<SyncCallback> callb
 
 Status SingleStoreImpl::UnRegisterSyncCallback()
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), TraceSwitch::BYTRACE_ON);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), TraceSwitch::BYTRACE_ON);
     syncObserver_->Clean();
     return SUCCESS;
 }
 
 Status SingleStoreImpl::SetSyncParam(const KvSyncParam &syncParam)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
     auto service = KVDBServiceClient::GetInstance();
     if (service == nullptr) {
         return SERVER_UNAVAILABLE;
@@ -515,7 +515,7 @@ Status SingleStoreImpl::SetSyncParam(const KvSyncParam &syncParam)
 
 Status SingleStoreImpl::GetSyncParam(KvSyncParam &syncParam)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
     auto service = KVDBServiceClient::GetInstance();
     if (service == nullptr) {
         return SERVER_UNAVAILABLE;
@@ -525,7 +525,7 @@ Status SingleStoreImpl::GetSyncParam(KvSyncParam &syncParam)
 
 Status SingleStoreImpl::SetCapabilityEnabled(bool enabled) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
     auto service = KVDBServiceClient::GetInstance();
     if (service == nullptr) {
         return SERVER_UNAVAILABLE;
@@ -539,7 +539,7 @@ Status SingleStoreImpl::SetCapabilityEnabled(bool enabled) const
 Status SingleStoreImpl::SetCapabilityRange(const std::vector<std::string> &localLabels,
     const std::vector<std::string> &remoteLabels) const
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
     auto service = KVDBServiceClient::GetInstance();
     if (service == nullptr) {
         return SERVER_UNAVAILABLE;
@@ -549,7 +549,7 @@ Status SingleStoreImpl::SetCapabilityRange(const std::vector<std::string> &local
 
 Status SingleStoreImpl::SubscribeWithQuery(const std::vector<std::string> &devices, const DataQuery &query)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
     auto service = KVDBServiceClient::GetInstance();
     if (service == nullptr) {
         return SERVER_UNAVAILABLE;
@@ -570,7 +570,7 @@ Status SingleStoreImpl::SubscribeWithQuery(const std::vector<std::string> &devic
 
 Status SingleStoreImpl::UnsubscribeWithQuery(const std::vector<std::string> &devices, const DataQuery &query)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true);
     auto service = KVDBServiceClient::GetInstance();
     if (service == nullptr) {
         return SERVER_UNAVAILABLE;
@@ -614,7 +614,7 @@ int32_t SingleStoreImpl::Close(bool isForce)
 
 Status SingleStoreImpl::Backup(const std::string &file, const std::string &baseDir)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     auto status = BackupManager::GetInstance().Backup(file, baseDir, storeId_, dbStore_);
     if (status != SUCCESS) {
         ZLOGE("status:0x%{public}x storeId:%{public}s backup:%{public}s ", status, storeId_.c_str(), file.c_str());
@@ -624,7 +624,7 @@ Status SingleStoreImpl::Backup(const std::string &file, const std::string &baseD
 
 Status SingleStoreImpl::Restore(const std::string &file, const std::string &baseDir)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     auto status = BackupManager::GetInstance().Restore(file, baseDir, appId_, storeId_, dbStore_);
     if (status != SUCCESS) {
         ZLOGE("status:0x%{public}x storeId:%{public}s backup:%{public}s ", status, storeId_.c_str(), file.c_str());
@@ -635,7 +635,7 @@ Status SingleStoreImpl::Restore(const std::string &file, const std::string &base
 Status SingleStoreImpl::DeleteBackup(const std::vector<std::string> &files, const std::string &baseDir,
     std::map<std::string, DistributedKv::Status> &results)
 {
-    DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
+    // DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__));
     for (auto &file : files) {
         results.emplace(file, DEVICE_NOT_FOUND);
     }
diff --git a/frameworks/libs/distributeddb/common/src/db_dfx_adapter.cpp b/frameworks/libs/distributeddb/common/src/db_dfx_adapter.cpp
index 6ffcc0d..c2a9e3a 100644
--- a/frameworks/libs/distributeddb/common/src/db_dfx_adapter.cpp
+++ b/frameworks/libs/distributeddb/common/src/db_dfx_adapter.cpp
@@ -27,8 +27,8 @@
 #include "runtime_context.h"
 #include "sqlite_utils.h"
 #ifdef USE_DFX_ABILITY
-#include "hitrace_meter.h"
-#include "hisysevent.h"
+// #include "hitrace_meter.h"
+// #include "hisysevent.h"
 #endif
 
 namespace DistributedDB {
-- 
2.24.3 (Apple Git-128)

