MCPcopy Create free account
hub / github.com/cuberite/cuberite / WriteCountStatistics

Function WriteCountStatistics

Tools/MemDumpAnalysis/MemDumpAnalysis.cpp:196–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194
195
196void WriteCountStatistics(void)
197{
198 typedef std::vector<std::pair<AString, int> > StringIntPairs;
199 StringIntPairs FnCounts;
200
201 cFile f("memdump_counts.txt", cFile::fmWrite);
202 if (!f.IsOpen())
203 {
204 LOGERROR("Cannot open memdump_counts.txt");
205 return;
206 }
207
208 for (FunctionMap::iterator itr = g_FnMap.begin(), end = g_FnMap.end(); itr != end; ++itr)
209 {
210 FnCounts.push_back(std::pair<AString, int>(itr->first, itr->second.m_Count));
211 } // for itr - g_FnSizes[]
212 std::sort(FnCounts.begin(), FnCounts.end(), CompareFnInt);
213
214 for (StringIntPairs::const_iterator itr = FnCounts.begin(), end = FnCounts.end(); itr != end; ++itr)
215 {
216 f.Printf("%d\t%s\n", itr->second, itr->first.c_str());
217 } // for itr - FnSizes[]
218}
219
220
221

Callers 1

mainFunction · 0.85

Calls 7

LOGERRORFunction · 0.85
sortFunction · 0.85
IsOpenMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
PrintfMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected