diff --git a/orbis-kernel/include/orbis/KernelContext.hpp b/orbis-kernel/include/orbis/KernelContext.hpp index c7ec46695..fefc92726 100644 --- a/orbis-kernel/include/orbis/KernelContext.hpp +++ b/orbis-kernel/include/orbis/KernelContext.hpp @@ -1,5 +1,6 @@ #pragma once #include "AppInfo.hpp" +#include "Budget.hpp" #include "KernelAllocator.hpp" #include "evf.hpp" #include "ipmi.hpp" @@ -14,6 +15,7 @@ #include #include #include +#include #include namespace orbis { @@ -193,14 +195,16 @@ public: Ref shmDevice; Ref dmemDevice; Ref blockpoolDevice; - shared_mutex gpuDeviceMtx; Ref gpuDevice; Ref dceDevice; + shared_mutex gpuDeviceMtx; uint sdkVersion{}; uint fwSdkVersion{}; uint safeMode{}; utils::RcIdMap ipmiMap; RcIdMap appInfos; + RcIdMap budgets; + Ref processTypeBudgets[4]; shared_mutex regMgrMtx; kmap regMgrInt; @@ -209,6 +213,19 @@ public: FwType fwType = FwType::Unknown; bool isDevKit = false; + Ref createProcessTypeBudget(Budget::ProcessType processType, + std::string_view name, + std::span items) { + auto budget = orbis::knew(name, processType, items); + processTypeBudgets[static_cast(processType)] = + orbis::knew(name, processType, items); + return budget; + } + + Ref getProcessTypeBudget(Budget::ProcessType processType) { + return processTypeBudgets[static_cast(processType)]; + } + private: shared_mutex m_heap_mtx; shared_mutex m_heap_map_mtx;