10#include <xaiefal/rsc/xaiefal-rsc-group.hpp>
11#include <xaiefal/common/xaiefal-base.hpp>
24 const std::string &Name =
""):
35 AieRC
addRsc(std::shared_ptr<XAieRsc> Rsc) {
37 std::vector<std::weak_ptr<XAieRsc>>::iterator
it;
39 for (
it = vRefs.begin();
it != vRefs.end();) {
58 std::vector<std::weak_ptr<XAieRsc>> vRefs;
60 XAieRscStat _getRscStat(
const std::vector<XAie_LocType> &vLocs,
62 uint32_t RscId)
const {
64 std::vector<XAieUserRsc> vRscs;
66 for (
auto Ref: vRefs) {
67 auto Rsc = Ref.lock();
73 auto RscWrapper = std::make_shared<
74 XAieRscGetRscsWrapper>(Rsc, vRscs);
77 for (
auto Rsc: vRscs) {
84 && Rsc.RscType != RscType) ||
88 RscStat.addRscStat(Rsc.Loc, Rsc.Mod, Rsc.RscType, 1);
104 const std::string &Name =
"Static"):
109 XAieRscStat _getRscStat(
const std::vector<XAie_LocType> &vLocs,
111 uint32_t RscId)
const {
113 std::vector<XAieUserRscStat> RscStats;
122 auto AieHdPtr =
AieHd.lock();
123 if (AieHdPtr ==
nullptr) {
124 throw std::invalid_argument(
"failed to get Aie ptr to get rsc stat for " +
132 lvLocs, Mod, RscType);
135 vLocs, Mod, RscType);
138 if (AieHdPtr->rscMgr()->getStaticRscs(RscStats) != XAIE_OK) {
141 for (
auto S: RscStats) {
142 if (S.NumRscs != 0) {
143 RscStat.addRscStat(S.Loc, S.Mod, S.RscType, S.NumRscs);
160 const std::string &Name =
"Avail"):
176 AieRC
addRsc(std::shared_ptr<XAieRsc> Rsc) {
178 std::vector<std::weak_ptr<XAieRsc>>::iterator
it;
181 throw std::invalid_argument(
182 "failed to add rsc to avail group, only trace controller is allowed");
184 for (
it = vRefs.begin();
it != vRefs.end();) {
185 auto lR =
it->lock();
198 vRefs.push_back(Rsc);
203 std::vector<std::weak_ptr<XAieRsc>> vRefs;
207 XAieRscStat _getRscStat(
const std::vector<XAie_LocType> &vLocs,
209 uint32_t RscId)
const {
210 std::vector<XAieUserRscStat> RscStats;
215 auto AieHdPtr =
AieHd.lock();
216 if (AieHdPtr ==
nullptr) {
217 throw std::invalid_argument(
"failed to get Aie ptr to get rsc stat for " +
234 lvLocs, Mod, lRscType);
237 vLocs, Mod, lRscType);
240 if (AieHdPtr->rscMgr()->getAvailRscs(RscStats) != XAIE_OK) {
243 for (
auto S: RscStats) {
244 if (S.NumRscs == 0) {
247 RscStat.addRscStat(S.Loc, S.Mod, S.RscType, S.NumRscs);
252 for (
auto Ref: vRefs) {
258 auto Rsc = Ref.lock();
259 if (Rsc ==
nullptr) {
263 ManagedRscType = Rsc->getManagedRscsType();
265 ManagedRscType != RscType) {
268 NumRscs = Rsc->getAvailManagedRscs();
273 Loc = std::static_pointer_cast<XAieSingleTileRsc>(Rsc)->loc();
274 Mod = std::static_pointer_cast<XAieSingleTileRsc>(Rsc)->mod();
275 if (RscStat.getNumRsc(Loc, Mod, Rsc->getRscType()) == 0 &&
276 Rsc->isReserved() ==
false) {
283 RscStat.addRscStat(std::static_pointer_cast<XAieSingleTileRsc>(Rsc)->loc(),
284 std::static_pointer_cast<XAieSingleTileRsc>(Rsc)->mod(),
285 ManagedRscType, NumRscs);
static std::ostream & log(LogLevel Lvl=LogLevel::FAL_MAX)
Definition xaiefal-log.hpp:50
XAieRscGroupAvail(std::shared_ptr< XAieDevHandle > DevHd, const std::string &Name="Avail")
Definition xaiefal-rsc-group-impl.hpp:159
XAieRscGroupAvail()
Definition xaiefal-rsc-group-impl.hpp:162
AieRC addRsc(std::shared_ptr< XAieRsc > Rsc)
Definition xaiefal-rsc-group-impl.hpp:176
std::weak_ptr< XAieDevHandle > AieHd
Definition xaiefal-rsc-group.hpp:327
static std::vector< XAie_LocType > _getAllTilesLocs(XAie_DevInst *DevInst)
Definition xaiefal-rsc-group.hpp:369
XAieRscGroupBase(std::shared_ptr< XAieDevHandle > DevHd, const std::string &Name="")
Definition xaiefal-rsc-group.hpp:205
std::string FuncName
Definition xaiefal-rsc-group.hpp:326
static std::vector< XAieUserRscStat > _createDrvRscStats(XAie_DevInst *DevInst, const std::vector< XAie_LocType > &vLocs, XAie_ModuleType Mod, XAieRscType RscType)
Definition xaiefal-rsc-group.hpp:401
XAieRscGroupRuntime(std::shared_ptr< XAieDevHandle > DevHd, const std::string &Name="")
Definition xaiefal-rsc-group-impl.hpp:23
~XAieRscGroupRuntime()
Definition xaiefal-rsc-group-impl.hpp:27
AieRC addRsc(std::shared_ptr< XAieRsc > Rsc)
Definition xaiefal-rsc-group-impl.hpp:35
XAieRscGroupRuntime()
Definition xaiefal-rsc-group-impl.hpp:26
XAieRscGroupStatic()
Definition xaiefal-rsc-group-impl.hpp:106
~XAieRscGroupStatic()
Definition xaiefal-rsc-group-impl.hpp:107
XAieRscGroupStatic(std::shared_ptr< XAieDevHandle > DevHd, const std::string &Name="Static")
Definition xaiefal-rsc-group-impl.hpp:103
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
Definition license.txt:89
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition license.txt:197
Definition xaiefal-base.hpp:23
XAieRscType
Enums representing all requestable resources.
Definition xaiefal-rsc-group.hpp:27
@ XAIE_TRACEEVENT
Definition xaiefal-rsc-group.hpp:38
@ XAIE_TRACECTRL
Definition xaiefal-rsc-group.hpp:30
@ FAL_ERROR
Definition xaiefal-log.hpp:14
struct of resource usage statistics
Definition xaiefal-rsc-group.hpp:66
#define XAIE_RSC_TYPE_ANY
Definition xaiefal-common.hpp:8
#define XAIE_LOC_ANY
Definition xaiefal-common.hpp:10
#define XAIE_MOD_ANY
Definition xaiefal-common.hpp:9
#define XAIE_RSC_ID_ANY
Definition xaiefal-common.hpp:7