summaryrefslogtreecommitdiffstats
path: root/Tools/MemDumpAnalysis
diff options
context:
space:
mode:
authorAlexander Lyons Harkness <me@bearbin.net>2017-12-23 13:49:08 +0100
committerAlexander Lyons Harkness <me@bearbin.net>2017-12-24 15:23:23 +0100
commit1926181cb7c8570fe57ec1b39d4241b9dd156333 (patch)
tree8ac9c6f24285846fa3f97f0a4ade9b0f9996f295 /Tools/MemDumpAnalysis
parentFixed item ID raw rabbit (#4103) (diff)
downloadcuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar
cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.gz
cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.bz2
cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.lz
cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.xz
cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.zst
cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.zip
Diffstat (limited to 'Tools/MemDumpAnalysis')
-rw-r--r--Tools/MemDumpAnalysis/Globals.cpp6
-rw-r--r--Tools/MemDumpAnalysis/MemDumpAnalysis.cpp26
-rw-r--r--Tools/MemDumpAnalysis/targetver.h8
3 files changed, 14 insertions, 26 deletions
diff --git a/Tools/MemDumpAnalysis/Globals.cpp b/Tools/MemDumpAnalysis/Globals.cpp
index 5b366f68e..7fba09ed0 100644
--- a/Tools/MemDumpAnalysis/Globals.cpp
+++ b/Tools/MemDumpAnalysis/Globals.cpp
@@ -1,10 +1,6 @@
-// Globals.cpp
+// Globals.cpp
// Used for precompiled header generation
#include "Globals.h"
-
-
-
-
diff --git a/Tools/MemDumpAnalysis/MemDumpAnalysis.cpp b/Tools/MemDumpAnalysis/MemDumpAnalysis.cpp
index 9faaef20f..58cb304c5 100644
--- a/Tools/MemDumpAnalysis/MemDumpAnalysis.cpp
+++ b/Tools/MemDumpAnalysis/MemDumpAnalysis.cpp
@@ -25,7 +25,7 @@ public:
int m_Size; ///< Sum of memory block sizes allocated by this function or its children
int m_Count; ///< Total number of memory blocks allocated by this function or its children
AStringSet m_ChildrenNames;
-
+
cFunction(void) :
m_Size(0),
m_Count(0)
@@ -66,7 +66,7 @@ bool IsFnBlackListed(const char * a_FnName)
"luaM_realloc_",
"",
} ;
-
+
for (int i = 0; i < ARRAYCOUNT(BlackList); i++)
{
if (strcmp(BlackList[i], a_FnName) == 0)
@@ -169,7 +169,7 @@ void WriteSizeStatistics(void)
{
typedef std::vector<std::pair<AString, int> > StringIntPairs;
StringIntPairs FnSizes;
-
+
cFile f("memdump_totals.txt", cFile::fmWrite);
if (!f.IsOpen())
{
@@ -182,7 +182,7 @@ void WriteSizeStatistics(void)
FnSizes.push_back(std::pair<AString, int>(itr->first, itr->second.m_Size));
} // for itr - g_FnSizes[]
std::sort(FnSizes.begin(), FnSizes.end(), CompareFnInt);
-
+
for (StringIntPairs::const_iterator itr = FnSizes.begin(), end = FnSizes.end(); itr != end; ++itr)
{
f.Printf("%d\t%s\n", itr->second, itr->first.c_str());
@@ -197,7 +197,7 @@ void WriteCountStatistics(void)
{
typedef std::vector<std::pair<AString, int> > StringIntPairs;
StringIntPairs FnCounts;
-
+
cFile f("memdump_counts.txt", cFile::fmWrite);
if (!f.IsOpen())
{
@@ -210,7 +210,7 @@ void WriteCountStatistics(void)
FnCounts.push_back(std::pair<AString, int>(itr->first, itr->second.m_Count));
} // for itr - g_FnSizes[]
std::sort(FnCounts.begin(), FnCounts.end(), CompareFnInt);
-
+
for (StringIntPairs::const_iterator itr = FnCounts.begin(), end = FnCounts.end(); itr != end; ++itr)
{
f.Printf("%d\t%s\n", itr->second, itr->first.c_str());
@@ -254,7 +254,7 @@ void WriteDotGraph(void)
LOGERROR("Cannot open memdump.dot");
return;
}
-
+
f.Printf("digraph {\n\tnode [shape=plaintext]\n\n");
for (FunctionMap::const_iterator itrF = g_FnMap.begin(), endF = g_FnMap.end(); itrF != endF; ++itrF)
{
@@ -288,11 +288,11 @@ int main(int argc, char * argv[])
printf("Cannot open memdump.xml\n");
return 1;
}
-
+
// Create the XML parser:
XML_Parser Parser = XML_ParserCreate(NULL);
XML_SetElementHandler(Parser, OnStartElement, OnEndElement);
-
+
// Feed the file through XML parser:
char Buffer[512 KiB];
while (true)
@@ -307,15 +307,11 @@ int main(int argc, char * argv[])
}
XML_Parse(Parser, "", 0, true);
f.Close();
-
+
// Output the statistics
WriteSizeStatistics();
WriteCountStatistics();
WriteDotGraph();
-
+
return 0;
}
-
-
-
-
diff --git a/Tools/MemDumpAnalysis/targetver.h b/Tools/MemDumpAnalysis/targetver.h
index 7f4aeaca1..3fedb6a1c 100644
--- a/Tools/MemDumpAnalysis/targetver.h
+++ b/Tools/MemDumpAnalysis/targetver.h
@@ -10,8 +10,8 @@
#pragma once
// The following macros define the minimum required platform. The minimum required platform
-// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
-// your application. The macros work by enabling all features available on platform versions up to and
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
@@ -19,7 +19,3 @@
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif
-
-
-
-