// EvalStats.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include #include using namespace std; bool extractRenderCost(ifstream &file, vector &renderCosts) { if (!file.is_open()) return false; string buf; bool isRenderCost = false; while (!(getline(file, buf)).eof()) { if (buf[0] == '#') { char entry[50]; sscanf(buf.c_str(), "#%s", entry); if (strcmp(entry, "TotalRenderCost") == 0) isRenderCost = true; } else if (isRenderCost) { float rc; sscanf(buf.c_str(), "%f", &rc); renderCosts.push_back(rc); isRenderCost = false; } } return true; } int _tmain(int argc, _TCHAR* argv[]) { vector renderCosts1; vector renderCosts2; ifstream file1(argv[1]); ifstream file2(argv[2]); ofstream statsOut(argv[3]); extractRenderCost(file1, renderCosts1); extractRenderCost(file2, renderCosts2); //statsOut << "rc1 size: " << (int)renderCosts1.size() << " " << (int)renderCosts2.size() << endl << endl; int n = min((int)renderCosts1.size(), (int)renderCosts2.size()); if (argc > 4) { char *endptr = NULL; int limit = strtol(argv[4], &endptr, 10); n = min(n, limit); } for (int i = 0; i < n; ++ i) { float costRatio = renderCosts2[i] != 0 ? renderCosts1[i] / renderCosts2[i] : renderCosts1[i] / 0.0000001f; statsOut << "#ViewCells\n" << i + 1 << endl << "#RenderCostRatio\n" << costRatio * 100.0f << endl; } return 0; }