Commits

Merov Linden committed 993f1b5

STORM-987 : Took Vadim's comment into account: check arguments consistency, make sure remaining perf data are flushed on exit.

Comments (0)

Files changed (4)

indra/integration_tests/llimage_libtest/llimage_libtest.cpp

 " -h, --help\n"
 "        Print this help\n"
 " -i, --input <file1 .. file2>\n"
-"        List of image files to load and convert, patterns can be used\n"
+"        List of image files to load and convert. Patterns with wild cards can be used.\n"
 " -o, --output <file1 .. file2> OR <type>\n"
 "        List of image files to create (assumes same order as for input files)\n"
-"        OR 3 letters file type extension to convert each input file into\n"
+"        OR 3 letters file type extension to convert each input file into.\n"
 " -log, --logmetrics <metric>\n"
-"        Log performance metric and data for <metric>\n"
+"        Log performance data for <metric>. Results in <metric>.slp\n"
+"        Note: so far, only ImageCompressionTester has been tested.\n"
 " -r, --analyzeperformance\n"
-"        Create report comparing baseline with current for <metric> provided in --logmetrics\n"
+"        Create a report comparing <metric>_baseline.slp with current <metric>.slp\n"
+"        Results in <metric>_report.csv"
 " -s, --image-stats\n"
-"        Output stats for each input and output image\n"
+"        Output stats for each input and output image.\n"
 "\n";
 
 // true when all image loading is done. Used by metric logging thread to know when to stop the thread.
 			os.flush();
 			ms_sleep(32);
 		}
+		LLFastTimer::writeLog(os);
+		os.flush();
 		os.close();
 	}		
 };
 		}
 	}
 		
-	// Analyze the list of (input,output) files
+	// Check arguments consistency. Exit with proper message if inconsistent.
 	if (input_filenames.size() == 0)
 	{
 		std::cout << "No input file, nothing to do -> exit" << std::endl;
 		return 0;
 	}
+	if (analyze_performance && !LLFastTimer::sMetricLog)
+	{
+		std::cout << "Cannot create perf report if no perf gathered (i.e. use argument -log <perf> with -r) -> exit" << std::endl;
+		return 0;
+	}
+	
 
 	// Create the logging thread if required
 	if (LLFastTimer::sMetricLog)
 			++out_file;
 		}
 	}
-	
-	sAllDone = true;
+
+	// Stop the perf gathering system if needed
+	if (LLFastTimer::sMetricLog)
+	{
+		LLMetricPerformanceTesterBasic::deleteTester(LLFastTimer::sLogName);
+		sAllDone = true;
+	}
 	
 	// Output perf data if requested by user
 	if (analyze_performance)

indra/llcommon/llmetricperformancetester.cpp

 	sTesterMap.insert(std::make_pair(name, tester));
 	return TRUE;
 }
-	
+
+/*static*/ 
+void LLMetricPerformanceTesterBasic::deleteTester(std::string name)
+{
+	name_tester_map_t::iterator tester = sTesterMap.find(name);
+	if (tester != sTesterMap.end())
+	{
+		delete tester->second;
+		sTesterMap.erase(tester);
+	}
+}
+
 /*static*/ 
 LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name) 
 {

indra/llcommon/llmetricperformancetester.h

 	static LLMetricPerformanceTesterBasic* getTester(std::string name) ;
 	
 	/**
+	 * @return Delete the named tester from the list 
+	 * @param[in] name - Name of the tester instance to delete.
+	 */
+	static void deleteTester(std::string name);
+
+	/**
 	 * @return Returns TRUE if that metric *or* the default catch all metric has been requested to be logged
 	 * @param[in] name - Name of the tester queried.
 	 */

indra/llimage/llimagej2c.cpp

 
 LLImageCompressionTester::~LLImageCompressionTester()
 {
+	outputTestResults();
 	LLImageJ2C::sTesterp = NULL;
 }