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 "schedule_config.h"
12 :
13 : namespace dgw {
14 :
15 366 : ScheduleConfig &ScheduleConfig::GetInstance()
16 : {
17 366 : static ScheduleConfig schedCfg;
18 366 : return schedCfg;
19 : }
20 :
21 2 : void ScheduleConfig::RecordConfig(
22 : const uint32_t key, const bqs::DynamicSchedQueueAttr &requestQ, const bqs::DynamicSchedQueueAttr &responseQ)
23 : {
24 2 : schedKeys_.insert(key);
25 2 : configMap_[key] = std::make_pair(requestQ, responseQ);
26 2 : }
27 :
28 307 : const std::unordered_set<uint32_t> &ScheduleConfig::GetSchedKeys() const
29 : {
30 307 : return schedKeys_;
31 : }
32 :
33 1 : void ScheduleConfig::StopSched(const uint32_t key)
34 : {
35 1 : stoppedSchedKeys_.insert(key);
36 1 : }
37 :
38 1 : void ScheduleConfig::RestartSched(const uint32_t key)
39 : {
40 1 : stoppedSchedKeys_.erase(key);
41 1 : }
42 :
43 49 : const bool ScheduleConfig::IsStopped(const uint32_t key) const
44 : {
45 49 : return stoppedSchedKeys_.count(key) > 0U;
46 : }
47 : }
|