LCOV - code coverage report
Current view: top level - aicpu_schedule/stub - stub_shard.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 94.0 % 50 47
Test Date: 2026-08-12 11:05:02 Functions: 100.0 % 26 26

            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              : #include "aicpu_async_event.h"
      11              : #include "aicpu_context.h"
      12              : #include "aicpu_pulse.h"
      13              : 
      14              : namespace {
      15              : thread_local std::map<std::string, std::string> g_threadLocalCtx;
      16              : thread_local aicpu::aicpuProfContext_t g_curProfCtx;
      17              : } // namespace
      18              : 
      19              : namespace aicpu {
      20            1 : status_t aicpuSetContext(aicpuContext_t* ctx) { return AICPU_ERROR_NONE; }
      21              : 
      22            1 : status_t aicpuGetContext(aicpuContext_t* ctx)
      23              : {
      24            1 :     ctx->deviceId = 0;
      25            1 :     return AICPU_ERROR_NONE;
      26              : }
      27              : 
      28            1 : status_t aicpuSetProfContext(const aicpuProfContext_t& ctx) { return AICPU_ERROR_NONE; }
      29              : 
      30            1 : const aicpuProfContext_t& aicpuGetProfContext() { return g_curProfCtx; }
      31              : 
      32            1 : void DoSetThreadLocalCtx(const std::string& key, const std::string& value) { g_threadLocalCtx[key] = value; }
      33              : 
      34            2 : status_t SetThreadLocalCtx(const std::string& key, const std::string& value)
      35              : {
      36            2 :     if (key.empty()) {
      37            1 :         return AICPU_ERROR_FAILED;
      38              :     }
      39              :     try {
      40            1 :         DoSetThreadLocalCtx(key, value);
      41            0 :     } catch (std::exception& e) {
      42            0 :         return AICPU_ERROR_FAILED;
      43            0 :     }
      44            1 :     return AICPU_ERROR_NONE;
      45              : }
      46              : 
      47            3 : status_t GetThreadLocalCtx(const std::string& key, std::string& value)
      48              : {
      49            3 :     if (key.empty()) {
      50            1 :         return AICPU_ERROR_FAILED;
      51              :     }
      52            2 :     auto iter = g_threadLocalCtx.find(key);
      53            2 :     if (iter != g_threadLocalCtx.end()) {
      54            1 :         value = iter->second;
      55            1 :         return AICPU_ERROR_NONE;
      56              :     }
      57            1 :     return AICPU_ERROR_FAILED;
      58              : }
      59              : 
      60            1 : status_t SetOpname(const std::string& opname) { return AICPU_ERROR_NONE; }
      61              : 
      62            1 : status_t SetTaskAndStreamId(uint64_t taskId, uint32_t streamId) { return AICPU_ERROR_NONE; }
      63              : 
      64            1 : status_t SetAicpuRunMode(uint32_t runMode) { return AICPU_ERROR_NONE; }
      65              : 
      66            1 : void SetCustAicpuSdFlag(const bool isCustAicpuSdFlag) { (void)isCustAicpuSdFlag; }
      67              : 
      68            1 : bool IsCustAicpuSd() { return false; }
      69              : 
      70            1 : status_t GetAicpuRunMode(uint32_t& runMode)
      71              : {
      72            1 :     runMode = aicpu::AicpuRunMode::THREAD_MODE;
      73            1 :     return AICPU_ERROR_NONE;
      74              : }
      75              : 
      76            1 : AsyncEventManager::AsyncEventManager() {}
      77              : 
      78            1 : AsyncEventManager::~AsyncEventManager() {}
      79              : 
      80            1 : AsyncEventManager& AsyncEventManager::GetInstance()
      81              : {
      82            1 :     static AsyncEventManager asyncEventManager;
      83            1 :     return asyncEventManager;
      84              : }
      85              : 
      86            1 : void AsyncEventManager::Register(const NotifyFunc& notify) { return; }
      87              : 
      88            1 : void AsyncEventManager::NotifyWait(void* notifyParam, const uint32_t paramLen) { return; }
      89              : 
      90            1 : bool AsyncEventManager::RegEventCb(
      91              :     const uint32_t eventId, const uint32_t subEventId, const EventProcessCallBack& cb, const int32_t times)
      92              : {
      93            1 :     return true;
      94              : }
      95              : 
      96            1 : void AsyncEventManager::ProcessEvent(const uint32_t eventId, const uint32_t subEventId, void* param) { return; }
      97              : 
      98            1 : bool AsyncEventManager::RegOpEventCb(
      99              :     const uint32_t eventId, const uint32_t subEventId, const EventProcessCallBack& cb) const
     100              : {
     101              :     (void)eventId;
     102              :     (void)subEventId;
     103              :     (void)cb;
     104            1 :     return true;
     105              : }
     106              : 
     107            1 : void AsyncEventManager::UnregOpEventCb(const uint32_t eventId, const uint32_t subEventId) const
     108              : {
     109              :     (void)eventId;
     110              :     (void)subEventId;
     111            1 : }
     112              : 
     113            1 : void AsyncEventManager::ProcessOpEvent(const uint32_t eventId, const uint32_t subEventId, void* const param) const
     114              : {
     115              :     (void)eventId;
     116              :     (void)subEventId;
     117              :     (void)param;
     118            1 : }
     119              : 
     120            1 : uint32_t GetUniqueVfId() { return 0U; }
     121              : 
     122            1 : void SetUniqueVfId(const uint32_t uniqueVfId) { (void)uniqueVfId; }
     123              : } // namespace aicpu
     124              : 
     125              : typedef void (*PulseNotifyFunc)();
     126              : 
     127            1 : int32_t RegisterPulseNotifyFunc(const char* name, PulseNotifyFunc func) { return 0; }
        

Generated by: LCOV version 2.0-1