LCOV - code coverage report
Current view: top level - server - queue_schedule_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              : 
      11              : #ifndef QUEUE_SCHEDULE_SUB_MODULE_INTERFACE_H
      12              : #define QUEUE_SCHEDULE_SUB_MODULE_INTERFACE_H
      13              : 
      14              : #include <string>
      15              : #include <atomic>
      16              : #include "tsd.h"
      17              : #include "qs_args_parser.h"
      18              : 
      19              : namespace bqs {
      20              : const std::string ERROR_MSG_ATTACH_GROUP_FAILED = "EM9001";
      21              : const std::string ERROR_MSG_QS_INIT_FAILED = "EM9002";
      22              : class SubModuleInterface {
      23              : public:
      24              :     struct TsdEventKey {
      25              :         uint32_t deviceId;
      26              :         uint32_t hostPid;
      27              :         uint32_t vfId;
      28              :     };
      29              : 
      30           78 :     static SubModuleInterface &GetInstance()
      31              :     {
      32              :         static SubModuleInterface instance;
      33           78 :         return instance;
      34              :     }
      35              :     int32_t StartQueueScheduleModule(const struct TsdSubEventInfo * const eventInfo);
      36              :     int32_t StopQueueScheduleModule(const struct TsdSubEventInfo * const eventInfo);
      37              : 
      38           56 :     inline bool GetStartFlag() const
      39              :     {
      40           56 :         return startFlag_.load();
      41              :     }
      42              : 
      43              :     static bool QsSubModuleAttachGroup(const ArgsParser &startParams);
      44              : 
      45              : private:
      46              :     SubModuleInterface() = default;
      47              :     ~SubModuleInterface() = default;
      48              : 
      49              :     void SetTsdEventKey(const struct TsdSubEventInfo * const eventInfo);
      50              :     bool ParseArgsFromFile(ArgsParser &startParams) const;
      51              :     std::string BuildArgsFilePath() const;
      52              :     static void DeleteArgsFile(const std::string &argsFilePath);
      53              :     int32_t SendSubModuleRsponse(const uint32_t eventType) const;
      54              :     void QsSubModuleInitQsInitParams(InitQsParams &initQsParams, const ArgsParser &startParams);
      55              :     void ReportErrMsgToTsd(const int32_t errCode) const;
      56              :     TsdEventKey tsdEventKey_;
      57              :     std::atomic<bool> startFlag_;
      58              : };
      59              : 
      60              : } // namespace bqs
      61              : 
      62              : extern "C"
      63              : {
      64              : __attribute__((visibility("default"))) int32_t StartQueueScheduleModule(const struct TsdSubEventInfo * const eventInfo);
      65              : __attribute__((visibility("default"))) int32_t StopQueueScheduleModule(const struct TsdSubEventInfo * const eventInfo);
      66              : }
      67              : 
      68              : #endif // QUEUE_SCHEDULE_SUB_MODULE_INTERFACE_H
        

Generated by: LCOV version 2.0-1