LCOV - code coverage report
Current view: top level - acl/aclrt_impl - snapshot.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 48 52 92.3 %
Date: 2026-08-27 13:24:42 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3             :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4             :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5             :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6             :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7             :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8             :  * See LICENSE in the root of the software repository for the full text of the License.
       9             :  */
      10             : 
      11             : #include "acl_rt_impl.h"
      12             : #include "runtime/rts/rts_snapshot.h"
      13             : #include "common/log_inner.h"
      14             : #include "common/error_codes_inner.h"
      15             : #include "common/prof_reporter.h"
      16             : 
      17           2 : aclError aclrtSnapShotProcessLockImpl()
      18             : {
      19           4 :     ACL_PROFILING_REG(acl::AclProfType::AclrtSnapShotProcessLock);
      20           2 :     ACL_LOG_INFO("start to execute aclrtSnapShotProcessLock");
      21           2 :     const rtError_t rtErr = rtSnapShotProcessLock();
      22           2 :     if (rtErr != RT_ERROR_NONE) {
      23           1 :         ACL_LOG_CALL_ERROR("execute SnapShotProcessLock failed, runtime result = %d", static_cast<int32_t>(rtErr));
      24           1 :         return ACL_GET_ERRCODE_RTS(rtErr);
      25             :     }
      26             : 
      27           1 :     ACL_LOG_INFO("successfully execute aclrtSnapShotProcessLock");
      28           1 :     return ACL_SUCCESS;
      29             : }
      30             : 
      31           2 : aclError aclrtSnapShotProcessUnlockImpl()
      32             : {
      33           4 :     ACL_PROFILING_REG(acl::AclProfType::AclrtSnapShotProcessUnlock);
      34           2 :     ACL_LOG_INFO("start to execute aclrtSnapShotProcessUnlock");
      35           2 :     const rtError_t rtErr = rtSnapShotProcessUnlock();
      36           2 :     if (rtErr != RT_ERROR_NONE) {
      37           1 :         ACL_LOG_CALL_ERROR("execute SnapShotProcessUnLock failed, runtime result = %d", static_cast<int32_t>(rtErr));
      38           1 :         return ACL_GET_ERRCODE_RTS(rtErr);
      39             :     }
      40             : 
      41           1 :     ACL_LOG_INFO("successfully execute aclrtSnapShotProcessUnlock");
      42           1 :     return ACL_SUCCESS;
      43             : }
      44             : 
      45           2 : aclError aclrtSnapShotProcessBackupImpl()
      46             : {
      47           4 :     ACL_PROFILING_REG(acl::AclProfType::AclrtSnapShotProcessBackup);
      48           2 :     ACL_LOG_INFO("start to execute aclrtSnapShotProcessBackup");
      49           2 :     const rtError_t rtErr = rtSnapShotProcessBackup();
      50           2 :     if (rtErr != RT_ERROR_NONE) {
      51           1 :         ACL_LOG_CALL_ERROR("execute SnapShotProcessBackup failed, runtime result = %d", static_cast<int32_t>(rtErr));
      52           1 :         return ACL_GET_ERRCODE_RTS(rtErr);
      53             :     }
      54             : 
      55           1 :     ACL_LOG_INFO("successfully execute aclrtSnapShotProcessBackup");
      56           1 :     return ACL_SUCCESS;
      57             : }
      58             : 
      59           2 : aclError aclrtSnapShotProcessRestoreImpl()
      60             : {
      61           4 :     ACL_PROFILING_REG(acl::AclProfType::AclrtSnapShotProcessRestore);
      62           2 :     ACL_LOG_INFO("start to execute aclrtSnapShotProcessRestore");
      63           2 :     const rtError_t rtErr = rtSnapShotProcessRestore();
      64           2 :     if (rtErr != RT_ERROR_NONE) {
      65           1 :         ACL_LOG_CALL_ERROR("execute SnapShotProcessRestore failed, runtime result = %d", static_cast<int32_t>(rtErr));
      66           1 :         return ACL_GET_ERRCODE_RTS(rtErr);
      67             :     }
      68             : 
      69           1 :     ACL_LOG_INFO("successfully execute aclrtSnapShotProcessRestore");
      70           1 :     return ACL_SUCCESS;
      71             : }
      72             : 
      73           1 : aclError aclrtSnapShotCallbackRegisterImpl(aclrtSnapShotStage stage, aclrtSnapShotCallBack callback, void* args)
      74             : {
      75           1 :     ACL_LOG_INFO("start to execute aclrtSnapShotCallbackRegister");
      76           1 :     const rtError_t rtErr = rtSnapShotCallbackRegister(
      77             :         static_cast<rtSnapShotStage>(stage), static_cast<rtSnapShotCallBack>(callback), args);
      78           1 :     if (rtErr != RT_ERROR_NONE) {
      79           1 :         ACL_LOG_CALL_ERROR("execute SnapShotCallbackRegister failed, runtime result = %d", static_cast<int32_t>(rtErr));
      80           1 :         return ACL_GET_ERRCODE_RTS(rtErr);
      81             :     }
      82           0 :     ACL_LOG_INFO("successfully execute aclrtSnapShotCallbackRegister");
      83           0 :     return ACL_SUCCESS;
      84             : }
      85             : 
      86           1 : aclError aclrtSnapShotCallbackUnregisterImpl(aclrtSnapShotStage stage, aclrtSnapShotCallBack callback)
      87             : {
      88           1 :     ACL_LOG_INFO("start to execute aclrtSnapShotCallbackUnregister");
      89             :     const rtError_t rtErr =
      90           1 :         rtSnapShotCallbackUnregister(static_cast<rtSnapShotStage>(stage), static_cast<rtSnapShotCallBack>(callback));
      91           1 :     if (rtErr != RT_ERROR_NONE) {
      92           1 :         ACL_LOG_CALL_ERROR(
      93             :             "execute SnapShotCallbackUnregister failed, runtime result = %d", static_cast<int32_t>(rtErr));
      94           1 :         return ACL_GET_ERRCODE_RTS(rtErr);
      95             :     }
      96           0 :     ACL_LOG_INFO("successfully execute aclrtSnapShotCallbackUnregister");
      97           0 :     return ACL_SUCCESS;
      98             : }

Generated by: LCOV version 1.14