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 { return schedKeys_; }
29 :
30 1 : void ScheduleConfig::StopSched(const uint32_t key) { stoppedSchedKeys_.insert(key); }
31 :
32 1 : void ScheduleConfig::RestartSched(const uint32_t key) { stoppedSchedKeys_.erase(key); }
33 :
34 49 : const bool ScheduleConfig::IsStopped(const uint32_t key) const { return stoppedSchedKeys_.count(key) > 0U; }
35 : } // namespace dgw
|