| 194 | |
| 195 | |
| 196 | void 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 | |