adds the del() log to world.log at roundend and allows the runtime condenser to parse and condense it

This commit is contained in:
duncathan
2015-10-05 18:52:44 -06:00
parent 52e072ceb3
commit e2ed83b6a5
3 changed files with 77 additions and 3 deletions
+8
View File
@@ -431,6 +431,14 @@ var/datum/subsystem/ticker/ticker
for(var/i in total_antagonists)
log_game("[i]s[total_antagonists[i]].")
//Adds the del() log to world.log in a format condensable by the runtime condenser found in tools
if(SSgarbage.didntgc.len)
var/dellog = ""
for(var/path in SSgarbage.didntgc)
dellog += "Path : [path] \n"
dellog += "Failures : [SSgarbage.didntgc[path]] \n"
world.log << dellog
return 1
/datum/subsystem/ticker/proc/send_random_tip()
+69 -3
View File
@@ -12,6 +12,8 @@
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
//Make all of these global. It's bad yes, but it's a small program so it really doesn't affect anything.
@@ -28,15 +30,20 @@ using namespace std;
string storedSource[maxStorage+1];
string storedUsr[maxStorage+1];
string storedSrc[maxStorage+1];
string storedHardDel[maxStorage+1];
//Stat tracking stuff for output
unsigned int totalRuntimes = 0;
unsigned int totalUniqueRuntimes = 0;
unsigned int totalInfiniteLoops = 0;
unsigned int totalUniqueInfiniteLoops = 0;
unsigned int totalHardDels = 0;
unsigned int totalUniqueHardDels = 0;
//Misc
unsigned int numRuntime[maxStorage+1]; //Number of times a specific runtime has occured
unsigned int numHardDel[maxStorage+1]; //Number of times a specific hard del has occured
bool checkNextLines = false; //Used in case byond has condensed a large number of similar runtimes
int storedIterator = 0; //Used to remember where we stored the runtime
@@ -94,7 +101,7 @@ bool readFromFile()
break;
}
//We've never encoutnered this
//We've never encountered this
if(storedRuntime[i] == "Blank")
{
storedRuntime[i] = currentLine;
@@ -122,7 +129,7 @@ bool readFromFile()
break;
}
//We've never encoutnered this
//We've never encountered this
if(storedRuntime[i] == "Blank")
{
storedRuntime[i] = currentLine;
@@ -135,6 +142,41 @@ bool readFromFile()
}
}
}
//Found a hard del!
else if(currentLine.find("Path :") != std::string::npos)
{
//this is pretty ugly but the alternative was implementing regex which I haven't the slightest idea how to do
//it takes advantage of the formatting of the line to extract the amount of failures
std::string tmp;
char c;
int failures;
std::stringstream ss(nextLine);
ss >> tmp >> c >> failures;
totalHardDels += failures;
for(int i=0; i <= maxStorage; i++)
{
//We've already encountered this
if(currentLine == storedHardDel[i])
{
numHardDel[i] += failures;
break;
}
//We've never encountered this
if(storedHardDel[i] == "Blank")
{
storedHardDel[i] = currentLine;
numHardDel[i] = failures;
checkNextLines = true;
totalUniqueHardDels++;
break;
}
}
}
}
}
else
@@ -158,16 +200,28 @@ bool writeToFile()
}
if(totalInfiniteLoops > 0)
{
outputFile << "Total infinite loops: " << totalInfiniteLoops << endl;
outputFile << "Total infinite loops: " << totalInfiniteLoops << endl << endl;
}
outputFile << "Total unique runtimes: " << totalUniqueRuntimes << endl;
outputFile << "Total runtimes: " << totalRuntimes << endl << endl;
if(totalUniqueHardDels > 0)
{
outputFile << "Total unique hard deletions: " << totalUniqueHardDels << endl;
}
if(totalHardDels > 0)
{
outputFile << "Total hard deletions: " << totalHardDels << endl << endl;
}
//Display a warning if we've hit the maximum space we've allocated for storage
if(totalUniqueRuntimes + totalUniqueInfiniteLoops >= maxStorage)
{
outputFile << "Warning: The maximum number of unique runtimes has been hit. If there were more, they have been cropped out.\n\n";
}
if(totalUniqueHardDels >= maxStorage)
{
outputFile << "Warning: The maximum number of unique hard deletions has been hit. If there were more, they have been croped out.\n\n";
}
//If we have infinite loops, display them first.
@@ -203,6 +257,16 @@ bool writeToFile()
if(storedUsr[i] != "Blank") outputFile << storedUsr[i] << endl;
if(storedSrc[i] != "Blank") outputFile << storedSrc[i] << endl;
}
if(totalHardDels > 0)
{
outputFile << "** Hard deletions **";
for(int i=0; i <= maxStorage; i++)
{
if(numHardDel[i] != 0) outputFile << endl << endl << "The following path has failed to GC " << numHardDel[i] << " time(s).\n";
if(storedHardDel[i] != "Blank") outputFile << storedRuntime[i] << endl;
}
}
outputFile.close();
}
else
@@ -278,6 +342,8 @@ int main() {
storedUsr[i] = "Blank";
storedSrc[i] = "Blank";
numRuntime[i] = 0;
storedHardDel[i] = "Blank";
numHardDel[i] = 0;
}
Binary file not shown.