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

            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 INTERFACE_AICPUSD_SUB_MODULE_INTERFACE_H
      11              : #define INTERFACE_AICPUSD_SUB_MODULE_INTERFACE_H
      12              : 
      13              : #include <string>
      14              : #include <atomic>
      15              : #include "tsd.h"
      16              : #include "aicpusd_args_parser.h"
      17              : 
      18              : namespace AicpuSchedule {
      19              : class SubModuleInterface {
      20              : public:
      21              :     struct TsdEventKey {
      22              :         uint32_t deviceId;
      23              :         uint32_t hostPid;
      24              :         uint32_t vfId;
      25              :     };
      26              : 
      27           89 :     static SubModuleInterface &GetInstance()
      28              :     {
      29              :         static SubModuleInterface instance;
      30           89 :         return instance;
      31              :     }
      32              :     int32_t StartAicpuSchedulerModule(const struct TsdSubEventInfo * const eventInfo);
      33              :     int32_t StopAicpuSchedulerModule(const struct TsdSubEventInfo * const eventInfo);
      34              : 
      35           24 :     inline bool GetStartFlag() const
      36              :     {
      37           24 :         return startFlag_.load();
      38              :     }
      39              : 
      40              : private:
      41              :     SubModuleInterface() = default;
      42              :     ~SubModuleInterface() = default;
      43              : 
      44              :     void SetTsdEventKey(const struct TsdSubEventInfo * const eventInfo);
      45              :     bool ParseArgsFromFile(ArgsParser &startParas) const;
      46              :     std::string BuildArgsFilePath() const;
      47              :     static void DeleteArgsFile(const std::string &argsFilePath);
      48              : 
      49              :     void ReportErrMsgToTsd(const int32_t errCode) const;
      50              :     static bool AttachHostGroup(const ArgsParser &startParas);
      51              :     void SendPidQosMsgToTsd(const uint32_t pidQos) const;
      52              :     int32_t SendSubModuleRsponse(const uint32_t eventType) const;
      53              : 
      54              :     TsdEventKey tsdEventKey_;
      55              :     std::atomic<bool> startFlag_;
      56              : };
      57              : 
      58              : } // namespace AicpuSchedule
      59              : 
      60              : extern "C"
      61              : {
      62              : __attribute__((visibility("default"))) int32_t StartAicpuSchedulerModule(const struct TsdSubEventInfo *const eventInfo);
      63              : __attribute__((visibility("default"))) int32_t StopAicpuSchedulerModule(const struct TsdSubEventInfo *const eventInfo);
      64              : }
      65              : 
      66              : #endif // INTERFACE_AICPUSD_SUB_MODULE_INTERFACE_H
        

Generated by: LCOV version 2.0-1