1
0

AnvilStats: changed all statistics counters to UInt64

git-svn-id: http://mc-server.googlecode.com/svn/trunk@927 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-10-04 12:32:56 +00:00
parent 1accc5aee8
commit bb8a19c71a
3 changed files with 32 additions and 24 deletions

View File

@ -72,6 +72,10 @@ typedef long long Int64;
typedef int Int32; typedef int Int32;
typedef short Int16; typedef short Int16;
typedef unsigned long long UInt64;
typedef unsigned int UInt32;
typedef unsigned short UInt16;

View File

@ -355,7 +355,7 @@ void cStatisticsFactory::SaveBiomes(void)
for (int i = 0; i <= 255; i++) for (int i = 0; i <= 255; i++)
{ {
AString Line; AString Line;
Printf(Line, "%s\t%d\t%d\t%.05f\n", GetBiomeString(i), i, m_CombinedStats.m_BiomeCounts[i], ((double)(m_CombinedStats.m_BiomeCounts[i])) / TotalColumns); Printf(Line, "%s\t%d\t%llu\t%.05f\n", GetBiomeString(i), i, m_CombinedStats.m_BiomeCounts[i], ((double)(m_CombinedStats.m_BiomeCounts[i])) / TotalColumns);
f.Write(Line.c_str(), Line.length()); f.Write(Line.c_str(), Line.length());
} }
} }
@ -380,13 +380,13 @@ void cStatisticsFactory::SaveBlockTypes(void)
} }
for (int i = 0; i <= 255; i++) for (int i = 0; i <= 255; i++)
{ {
int Count = 0; UInt64 Count = 0;
for (int Biome = 0; Biome <= 255; ++Biome) for (int Biome = 0; Biome <= 255; ++Biome)
{ {
Count += m_CombinedStats.m_BlockCounts[Biome][i]; Count += m_CombinedStats.m_BlockCounts[Biome][i];
} }
AString Line; AString Line;
Printf(Line, "%s\t%d\t%d\t%.08f\n", GetBlockTypeString(i), i, Count, ((double)Count) / TotalBlocks); Printf(Line, "%s\t%d\t%llu\t%.08f\n", GetBlockTypeString(i), i, Count, ((double)Count) / TotalBlocks);
f.Write(Line.c_str(), Line.length()); f.Write(Line.c_str(), Line.length());
} }
} }
@ -430,7 +430,7 @@ void cStatisticsFactory::SaveBiomeBlockTypes(void)
Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType); Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType);
for (int Biome = 0; Biome <= 127; Biome++) for (int Biome = 0; Biome <= 127; Biome++)
{ {
AppendPrintf(Line, "\t%d", m_CombinedStats.m_BlockCounts[Biome][BlockType]); AppendPrintf(Line, "\t%llu", m_CombinedStats.m_BlockCounts[Biome][BlockType]);
} }
Line.append("\n"); Line.append("\n");
f.Write(Line.c_str(), Line.length()); f.Write(Line.c_str(), Line.length());
@ -458,7 +458,7 @@ void cStatisticsFactory::SaveBiomeBlockTypes(void)
Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType); Printf(Line, "%s\t%d", GetBlockTypeString(BlockType), BlockType);
for (int Biome = 128; Biome <= 255; Biome++) for (int Biome = 128; Biome <= 255; Biome++)
{ {
AppendPrintf(Line, "\t%d", m_CombinedStats.m_BlockCounts[Biome][BlockType]); AppendPrintf(Line, "\t%llu", m_CombinedStats.m_BlockCounts[Biome][BlockType]);
} }
Line.append("\n"); Line.append("\n");
f.Write(Line.c_str(), Line.length()); f.Write(Line.c_str(), Line.length());
@ -481,15 +481,18 @@ void cStatisticsFactory::SaveStatistics(void)
int Elapsed = (clock() - m_BeginTick) / CLOCKS_PER_SEC; int Elapsed = (clock() - m_BeginTick) / CLOCKS_PER_SEC;
f.Printf("Time elapsed: %d seconds (%d hours, %d minutes and %d seconds)\n", Elapsed, Elapsed / 3600, (Elapsed / 60) % 60, Elapsed % 60); f.Printf("Time elapsed: %d seconds (%d hours, %d minutes and %d seconds)\n", Elapsed, Elapsed / 3600, (Elapsed / 60) % 60, Elapsed % 60);
f.Printf("Total chunks processed: %d\n", m_CombinedStats.m_TotalChunks); f.Printf("Total chunks processed: %llu\n", m_CombinedStats.m_TotalChunks);
f.Printf("Chunk processing speed: %.02f chunks per second\n", (double)(m_CombinedStats.m_TotalChunks) / Elapsed); if (Elapsed > 0)
f.Printf("Biomes counted for %d chunks.\n", m_CombinedStats.m_BiomeNumChunks); {
f.Printf("Blocktypes counted for %d chunks.\n", m_CombinedStats.m_BlockNumChunks); f.Printf("Chunk processing speed: %.02f chunks per second\n", (double)(m_CombinedStats.m_TotalChunks) / Elapsed);
f.Printf("Total blocks counted: %lld\n", (Int64)(m_CombinedStats.m_BlockNumChunks) * 16 * 16 * 256); }
f.Printf("Total biomes counted: %lld\n", (Int64)(m_CombinedStats.m_BiomeNumChunks) * 16 * 16); f.Printf("Biomes counted for %llu chunks.\n", m_CombinedStats.m_BiomeNumChunks);
f.Printf("Total entities counted: %d\n", m_CombinedStats.m_NumEntities); f.Printf("Blocktypes counted for %llu chunks.\n", m_CombinedStats.m_BlockNumChunks);
f.Printf("Total tile entities counted: %d\n", m_CombinedStats.m_NumTileEntities); f.Printf("Total blocks counted: %llu\n", m_CombinedStats.m_BlockNumChunks * 16 * 16 * 256);
f.Printf("Total tile ticks counted: %d\n", m_CombinedStats.m_NumTileTicks); f.Printf("Total biomes counted: %llu\n", m_CombinedStats.m_BiomeNumChunks * 16 * 16);
f.Printf("Total entities counted: %llu\n", m_CombinedStats.m_NumEntities);
f.Printf("Total tile entities counted: %llu\n", m_CombinedStats.m_NumTileEntities);
f.Printf("Total tile ticks counted: %llu\n", m_CombinedStats.m_NumTileTicks);
f.Printf("Chunk coord ranges:\n"); f.Printf("Chunk coord ranges:\n");
f.Printf("\tX: %d .. %d\n", m_CombinedStats.m_MinChunkX, m_CombinedStats.m_MaxChunkX); f.Printf("\tX: %d .. %d\n", m_CombinedStats.m_MinChunkX, m_CombinedStats.m_MaxChunkX);
f.Printf("\tZ: %d .. %d\n", m_CombinedStats.m_MinChunkZ, m_CombinedStats.m_MaxChunkZ); f.Printf("\tZ: %d .. %d\n", m_CombinedStats.m_MinChunkZ, m_CombinedStats.m_MaxChunkZ);
@ -511,7 +514,7 @@ void cStatisticsFactory::SaveSpawners(void)
f.Printf("Entity type\tTotal count\tCount per chunk\n"); f.Printf("Entity type\tTotal count\tCount per chunk\n");
for (int i = 0; i < entMax; i++) for (int i = 0; i < entMax; i++)
{ {
f.Printf("%s\t%d\t%0.4f\n", GetEntityTypeString((eEntityType)i), m_CombinedStats.m_SpawnerEntity[i], (double)(m_CombinedStats.m_SpawnerEntity[i]) / m_CombinedStats.m_BlockNumChunks); f.Printf("%s\t%llu\t%0.4f\n", GetEntityTypeString((eEntityType)i), m_CombinedStats.m_SpawnerEntity[i], (double)(m_CombinedStats.m_SpawnerEntity[i]) / m_CombinedStats.m_BlockNumChunks);
} }
} }

View File

@ -23,18 +23,19 @@ public:
class cStats class cStats
{ {
public: public:
int m_TotalChunks; // Total number of chunks that go through this callback (OnNewChunk()) UInt64 m_TotalChunks; // Total number of chunks that go through this callback (OnNewChunk())
int m_BiomeCounts[256]; UInt64 m_BiomeCounts[256];
int m_BlockCounts[256][256]; // First dimension is the biome, second dimension is BlockType UInt64 m_BlockCounts[256][256]; // First dimension is the biome, second dimension is BlockType
int m_BiomeNumChunks; // Num chunks that have been processed for biome stats UInt64 m_BiomeNumChunks; // Num chunks that have been processed for biome stats
int m_BlockNumChunks; // Num chunks that have been processed for block stats UInt64 m_BlockNumChunks; // Num chunks that have been processed for block stats
int m_NumEntities; UInt64 m_NumEntities;
int m_NumTileEntities; UInt64 m_NumTileEntities;
int m_NumTileTicks; UInt64 m_NumTileTicks;
int m_MinChunkX, m_MaxChunkX; // X coords range int m_MinChunkX, m_MaxChunkX; // X coords range
int m_MinChunkZ, m_MaxChunkZ; // Z coords range int m_MinChunkZ, m_MaxChunkZ; // Z coords range
int m_SpawnerEntity[entMax + 1]; Int64 m;
UInt64 m_SpawnerEntity[entMax + 1];
cStats(void); cStats(void);
void Add(const cStats & a_Stats); void Add(const cStats & a_Stats);