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 "queue_schedule_interface.h"
12 : #include "qs_interface_process.h"
13 : #include "common/bqs_status.h"
14 : #include "common/bqs_log.h"
15 : #include "queue_schedule/qs_client.h"
16 :
17 : extern "C" {
18 1 : int32_t InitQueueScheduler(const uint32_t deviceId, const uint32_t reschedInterval)
19 : {
20 1 : BQS_LOG_RUN_INFO("QueueSchedule begin.");
21 1 : const uint32_t enqueGroupId = static_cast<uint32_t>(bqs::EventGroupId::ENQUEUE_GROUP_ID);
22 1 : const uint32_t f2nfGroupId = static_cast<uint32_t>(bqs::EventGroupId::F2NF_GROUP_ID);
23 :
24 1 : const bqs::InitQsParams initQsParams = {
25 : .deviceId = deviceId,
26 : .enqueGroupId = enqueGroupId,
27 : .f2nfGroupId = f2nfGroupId,
28 : .reschedInterval = reschedInterval,
29 : .runMode = bqs::QueueSchedulerRunMode::MULTI_THREAD,
30 : .pid = 0U,
31 : .vfId = 0U,
32 0 : .pidSign = "",
33 1 : .qsInitGrpName = "",
34 : .schedPolicy = 0UL,
35 : .starter = bqs::QsStartType::START_BY_TSD,
36 1 : .profCfgData = "",
37 : .abnormalInterVal = 0U,
38 : .profFlag = false,
39 : .enqueGroupIdExtra = 0U,
40 : .f2nfGroupIdExtra = 0U,
41 : .deviceIdExtra = 0U,
42 : .numaFlag = false,
43 : .devIdVec = {},
44 : .needAttachGroup = false,
45 4 : };
46 1 : const auto bsqStatus = bqs::QueueScheduleInterface::GetInstance().InitQueueScheduler(initQsParams);
47 1 : if (bsqStatus != static_cast<int32_t>(bqs::BQS_STATUS_OK)) {
48 0 : BQS_LOG_ERROR("QueueSchedule start failed, ret[%d].", bsqStatus);
49 0 : return static_cast<int32_t>(bsqStatus);
50 : }
51 1 : BQS_LOG_RUN_INFO("QueueSchedule start success.");
52 1 : return static_cast<int32_t>(bqs::BQS_STATUS_OK);
53 1 : }
54 : }
|