|
@@ -0,0 +1,111 @@
|
|
|
|
|
+// =====================================================================================
|
|
|
|
|
+//
|
|
|
|
|
+// Filename: stat.cc
|
|
|
|
|
+//
|
|
|
|
|
+// Description: statistics of experiment results
|
|
|
|
|
+//
|
|
|
|
|
+// Version: 1.0
|
|
|
|
|
+// Created: 2015年10月10日 11时11分56秒
|
|
|
|
|
+// Revision: none
|
|
|
|
|
+// Compiler: g++
|
|
|
|
|
+//
|
|
|
|
|
+// Author: Jinkun Lin, jkunlin@gmail.com
|
|
|
|
|
+// Organization: School of EECS, Peking University
|
|
|
|
|
+//
|
|
|
|
|
+// =====================================================================================
|
|
|
|
|
+
|
|
|
|
|
+#include <iostream>
|
|
|
|
|
+#include <fstream>
|
|
|
|
|
+#include <sstream>
|
|
|
|
|
+#include <string>
|
|
|
|
|
+#include <vector>
|
|
|
|
|
+#include <limits>
|
|
|
|
|
+
|
|
|
|
|
+using namespace std;
|
|
|
|
|
+
|
|
|
|
|
+class Director_entry {/*{{{*/
|
|
|
|
|
+public:
|
|
|
|
|
+ Director_entry (string director_name) {
|
|
|
|
|
+ string cmd = "ls " + director_name + " > " + director_name + "_tmpfile.txt";
|
|
|
|
|
+ system(cmd.c_str());
|
|
|
|
|
+ fstream file(director_name + "_tmpfile.txt");
|
|
|
|
|
+ if (!file.is_open()) {
|
|
|
|
|
+ cout << "can't open dir" << endl;
|
|
|
|
|
+ exit(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ string line;
|
|
|
|
|
+ while (getline(file, line)) {
|
|
|
|
|
+ file_name.push_back(line);
|
|
|
|
|
+ }
|
|
|
|
|
+ file.close();
|
|
|
|
|
+ cmd = "rm " + director_name + "_tmpfile.txt";
|
|
|
|
|
+ system(cmd.c_str());
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ vector<string>::const_iterator begin() {
|
|
|
|
|
+ return file_name.begin();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ vector<string>::const_iterator end() {
|
|
|
|
|
+ return file_name.end();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ vector<string>::size_type size() {
|
|
|
|
|
+ return file_name.size();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ using size_type = vector<string>::size_type;
|
|
|
|
|
+
|
|
|
|
|
+ string& operator [] (size_type i) {
|
|
|
|
|
+ return file_name[i];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+private:
|
|
|
|
|
+ vector<string> file_name;
|
|
|
|
|
+};/*}}}*/
|
|
|
|
|
+
|
|
|
|
|
+int main(int argc, char const *argv[]) {
|
|
|
|
|
+ if (argc != 2) {
|
|
|
|
|
+ std::cout << "usage: " << std::endl;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ string result_dir = argv[1];
|
|
|
|
|
+
|
|
|
|
|
+ fstream solution("solution.xls", ios::out);
|
|
|
|
|
+ if (!solution.is_open()) {
|
|
|
|
|
+ cout << "can't create simplification.xls" << endl;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ solution.precision(15);
|
|
|
|
|
+
|
|
|
|
|
+ vector<string> all_benchmark_name = {"bio", "col", "fb", "inf",
|
|
|
|
|
+ "int", "rec", "ret", "sci",
|
|
|
|
|
+ "soc", "tec", "web"};
|
|
|
|
|
+
|
|
|
|
|
+ for (auto benchmark_name : all_benchmark_name) {
|
|
|
|
|
+ cout << "**** " << benchmark_name << " ***" << endl;
|
|
|
|
|
+
|
|
|
|
|
+ Director_entry benchmark(result_dir + "/" + benchmark_name);
|
|
|
|
|
+ for (auto instance_name : benchmark) {
|
|
|
|
|
+ cout << instance_name << endl;
|
|
|
|
|
+
|
|
|
|
|
+ Director_entry instance(benchmark_name + "/" + instance_name);
|
|
|
|
|
+ Director_entry::size_type i = 0;
|
|
|
|
|
+ for (; i < instance.size(); ++i) {
|
|
|
|
|
+ string result_file_name = instance[i];
|
|
|
|
|
+
|
|
|
|
|
+ fstream result_file(benchmark_name + "/" + instance_name + "/" + result_file_name);
|
|
|
|
|
+ if (!result_file.is_open()) {
|
|
|
|
|
+ cout << "result file error" << endl;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ result_file.close();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ solution << instance_name << endl;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ solution.close();
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|