From 699663016d5ee1c0da6f8f426f396c262ab9467f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BC=9F?= Date: Fri, 20 Jun 2025 07:01:01 +0000 Subject: [PATCH 1/5] update services/native/include/work_scheduler_service.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- services/native/include/work_scheduler_service.h | 1 + 1 file changed, 1 insertion(+) diff --git a/services/native/include/work_scheduler_service.h b/services/native/include/work_scheduler_service.h index e6bfbb2..dae125d 100644 --- a/services/native/include/work_scheduler_service.h +++ b/services/native/include/work_scheduler_service.h @@ -370,6 +370,7 @@ private: void CancelTimer(int32_t id); bool CheckCallingToken(); void DumpTriggerWork(const std::string& uIdStr, const std::string& workIdStr, std::string& result); + void ReportUserDataSizeEvent(); private: std::set whitelist_; -- Gitee From fd6ccce4f7cece1ed13fc105406d67eb9f1ec7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BC=9F?= Date: Fri, 20 Jun 2025 07:01:34 +0000 Subject: [PATCH 2/5] update services/native/src/work_scheduler_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- .../native/src/work_scheduler_service.cpp | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index a77d469..8bb2d10 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -1786,5 +1786,43 @@ bool WorkSchedulerService::CheckCallingToken() } return false; } + +uint64_t GetRemainPartitionSize(const std::string& partitionName) +{ + struct statfs stat; + if (statfs(partitionName.c_str(), &stat) != 0) { + return -1; + } + uint64_t blockSize = stat.f_bsize; + uint64_t freeSize = stat.f_bfree * blockSize; + constexpr double units = 1024.0; + return freeSize / (units * units); +} + +std::vector GetFileOrFolderSize(const std::vector& paths) +{ + std::vector folderSize; + for (auto path : paths) { + folderSize.emplace_back(OHOS::GetFolderSize(path)); + } + return folderSize; +} + +void WorkSchedulerService::ReportUserDataSizeEvent() +{ + std::vector paths = { + "/data/service/el1/public/WorkScheduler/" + }; + uint64_t remainPartitionSize = GetRemainPartitionSize("/data"); + std::vector folderSize = GetFileOrFolderSize(paths); + WS_HILOGE("CJM 大数据打点."); + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::FILEMANAGEMENT, "USER_DATA_SIZE", + HiviewDFX::HiSysEvent::EventType::STATISTIC, + "COMPONENT_NAME", "work_scheduler", + "PARTITION_NAME", "/data", + "REMAIN_PARTITION_SIZE", remainPartitionSize, + "FILE_OR_FOLDER_PATH", paths, + "FILE_OR_FOLDER_SIZE", folderSize); +} } // namespace WorkScheduler } // namespace OHOS -- Gitee From 27e9436e449655ecc08af36a4665be5652a4b84e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BC=9F?= Date: Fri, 20 Jun 2025 07:06:16 +0000 Subject: [PATCH 3/5] update services/native/src/work_scheduler_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- services/native/src/work_scheduler_service.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index 8bb2d10..b9e7ff2 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -1344,6 +1344,7 @@ void WorkSchedulerService::RefreshPersistedWorks() fout.open(realPath, ios::out); fout< Date: Fri, 20 Jun 2025 07:08:35 +0000 Subject: [PATCH 4/5] update services/native/src/work_scheduler_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- services/native/src/work_scheduler_service.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index b9e7ff2..05da980 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -1816,7 +1816,6 @@ void WorkSchedulerService::ReportUserDataSizeEvent() }; uint64_t remainPartitionSize = GetRemainPartitionSize("/data"); std::vector folderSize = GetFileOrFolderSize(paths); - WS_HILOGE("CJM 大数据打点."); HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::FILEMANAGEMENT, "USER_DATA_SIZE", HiviewDFX::HiSysEvent::EventType::STATISTIC, "COMPONENT_NAME", "work_scheduler", -- Gitee From 36fe799b07eb3f872c7c5b3e133a36207205d4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BC=9F?= Date: Fri, 20 Jun 2025 07:20:19 +0000 Subject: [PATCH 5/5] update services/native/src/work_scheduler_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡伟 --- services/native/src/work_scheduler_service.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/native/src/work_scheduler_service.cpp b/services/native/src/work_scheduler_service.cpp index 05da980..ed0af61 100644 --- a/services/native/src/work_scheduler_service.cpp +++ b/services/native/src/work_scheduler_service.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "parameters.h" @@ -51,6 +52,7 @@ #include "conditions/timer_listener.h" #include "conditions/group_listener.h" #include "config_policy_utils.h" // for GetOneCfgFile +#include "directory_ex.h" #include "event_publisher.h" #include "json/json.h" #include "policy/app_data_clear_listener.h" @@ -72,6 +74,7 @@ #include "work_sched_hilog.h" #include "work_sched_utils.h" #include "hitrace_meter.h" +#include "hisysevent.h" #include "res_type.h" #include "res_sched_client.h" #include "work_sched_data_manager.h" -- Gitee