MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / getStatInfo

Method getStatInfo

edrav2/iprj/libcore/src/core.cpp:131–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129 //
130 //
131 virtual Variant getStatInfo() const override
132 {
133 struct ClassStatInfo
134 {
135 ClassId nClassId = c_nInvalidClassId;
136 Size nCount = 0;
137
138 ClassStatInfo() = default;
139 ClassStatInfo(ClassId _nClassId, Size _nCount) : nClassId(_nClassId), nCount(_nCount) {}
140 };
141
142 // Avoid long locking of m_mtxFactoryMap
143 std::vector<ClassStatInfo> statInfo;
144 {
145 std::scoped_lock _lock(m_mtxFactoryMap);
146 statInfo.reserve(m_FactoryMap.size());
147
148 for (auto&[nClassId, info] : m_FactoryMap)
149 statInfo.emplace_back(nClassId, info.nObjCount);
150 }
151
152 Sequence vStatInfo;
153 Size nClassCount = statInfo.size();
154 vStatInfo.setSize(nClassCount);
155
156 for (Size i=0; i< nClassCount; ++i)
157 {
158 auto& info = statInfo[i];
159
160 vStatInfo.put(i, Dictionary({
161 { "clsid", info.nClassId },
162 { "count", info.nCount },
163 }));
164 }
165
166 return vStatInfo;
167 }
168
169 //
170 //

Callers

nothing calls this directly

Calls 6

DictionaryClass · 0.50
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45
setSizeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected