LCOV - code coverage report
Current view: top level - aicpu_prof - prof_so_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-07-28 10:54:05 Functions: 100.0 % 1 1

            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              : #ifndef PROF_SO_MANAGER_H
      11              : #define PROF_SO_MANAGER_H
      12              : 
      13              : #include <mutex>
      14              : #include <vector>
      15              : #include <string>
      16              : #include <unordered_map>
      17              : #include "prof_dev_api.h"
      18              : 
      19              : namespace aicpu {
      20              : using ProfAicpuStartRegisterFunc = int32_t (*)(AicpuStartFunc aicpuStartCallback, const struct AicpuStartPara *para);
      21              : using ProfReportDataFunc = int32_t (*)(VOID_PTR data, uint32_t len);
      22              : using ProfReportAdditionalInfoFunc = int32_t (*)(uint32_t agingFlag, const VOID_PTR data, uint32_t length);
      23              : using ProfAdprofAicpuStopFunc = int32_t (*)();
      24              : 
      25              : using ProfMsprofInitFunc = int32_t (*)(uint32_t dataType, VOID_PTR data, uint32_t dataLen);
      26              : using ProfMsprofReportAdditionalInfoFunc = int32_t (*)(uint32_t nonPersistantFlag, const VOID_PTR data, uint32_t length);
      27              : 
      28              : int32_t AdprofAicpuStartRegisterFunc(AicpuStartFunc aicpuStartCallback, const struct AicpuStartPara *para);
      29              : 
      30              : int32_t AdprofReportDataFunc(VOID_PTR data, uint32_t len);
      31              : 
      32              : int32_t AdprofReportAdditionalInfoFunc(uint32_t agingFlag, const VOID_PTR data, uint32_t length);
      33              : 
      34              : int32_t AdprofAicpuStopFunc();
      35              : 
      36              : int32_t MsprofInitFunc(uint32_t dataType, VOID_PTR data, uint32_t dataLen);
      37              : 
      38              : int32_t MsprofReportAdditionalInfoFunc(uint32_t nonPersistantFlag, const VOID_PTR data, uint32_t length);
      39              : 
      40              : class ProfSoManager {
      41              : public:
      42              :     static ProfSoManager *GetInstance();
      43              : 
      44              :     virtual ~ProfSoManager();
      45              : 
      46              :     /**
      47              :      * load msprof so
      48              :      */
      49              :     void LoadSo();
      50              : 
      51              :     /**
      52              :      * unload msprof so
      53              :      */
      54              :     void UnloadSo();
      55              : 
      56              :     /**
      57              :      * get function
      58              :      * @param name msprof function name
      59              :      * @return void *
      60              :      */
      61              :     void *GetFunc(const std::string &name) const;
      62              : 
      63              : private:
      64              :     /**
      65              :      * Init Function Map
      66              :      */
      67              :     void InitFunctionMap(const std::vector<std::string> &funcName);
      68            1 :     ProfSoManager() = default;
      69              : 
      70              :     std::unordered_map<std::string, void *> funcMap_;
      71              :     
      72              :     void *soHandle_ = nullptr;
      73              :     std::mutex profMtx_;
      74              : };
      75              : 
      76              : } // namespace aicpu
      77              : #endif // PROF_SO_MANAGER_H
        

Generated by: LCOV version 2.0-1