| 166 | |
| 167 | |
| 168 | void WriteSizeStatistics(void) |
| 169 | { |
| 170 | typedef std::vector<std::pair<AString, int> > StringIntPairs; |
| 171 | StringIntPairs FnSizes; |
| 172 | |
| 173 | cFile f("memdump_totals.txt", cFile::fmWrite); |
| 174 | if (!f.IsOpen()) |
| 175 | { |
| 176 | LOGERROR("Cannot open memdump_totals.txt"); |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | for (FunctionMap::iterator itr = g_FnMap.begin(), end = g_FnMap.end(); itr != end; ++itr) |
| 181 | { |
| 182 | FnSizes.push_back(std::pair<AString, int>(itr->first, itr->second.m_Size)); |
| 183 | } // for itr - g_FnSizes[] |
| 184 | std::sort(FnSizes.begin(), FnSizes.end(), CompareFnInt); |
| 185 | |
| 186 | for (StringIntPairs::const_iterator itr = FnSizes.begin(), end = FnSizes.end(); itr != end; ++itr) |
| 187 | { |
| 188 | f.Printf("%d\t%s\n", itr->second, itr->first.c_str()); |
| 189 | } // for itr - FnSizes[] |
| 190 | } |
| 191 | |
| 192 | |
| 193 | |