From 898d47682b32bfffaa47edec9be1364c6df67eb2 Mon Sep 17 00:00:00 2001 From: Yu Shan Emily Lau Date: Fri, 20 Nov 2009 18:25:52 -0800 Subject: Split the startup measurment into two parts. 1) The first startup time 2) The average of the rest of the iterations ( ie. 19) --- .../com/android/camera/stress/CameraStartUp.java | 53 ++++++++++++++-------- 1 file changed, 35 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/src/com/android/camera/stress/CameraStartUp.java b/tests/src/com/android/camera/stress/CameraStartUp.java index 71325d2..b59d724 100644 --- a/tests/src/com/android/camera/stress/CameraStartUp.java +++ b/tests/src/com/android/camera/stress/CameraStartUp.java @@ -70,17 +70,22 @@ public class CameraStartUp extends InstrumentationTestCase { } private void writeToOutputFile(String startupTag, long totalStartupTime, - String individualStartupTime) throws Exception { - //TODO (yslau) : Need to integrate the output data with central dashboard + String individualStartupTime, boolean firstStartUp) throws Exception { + // TODO (yslau) : Need to integrate the output data with central + // dashboard try { FileWriter fstream = null; fstream = new FileWriter(CAMERA_TEST_OUTPUT_FILE, true); - long averageStartupTime = totalStartupTime / TOTAL_NUMBER_OF_STARTUP; BufferedWriter out = new BufferedWriter(fstream); - out.write(startupTag + "\n"); - out.write("Number of loop: " + TOTAL_NUMBER_OF_STARTUP + "\n"); - out.write(individualStartupTime + "\n\n"); - out.write("Average startup time :" + averageStartupTime + " ms\n\n"); + if (firstStartUp) { + out.write(startupTag + ": " + totalStartupTime + "\n"); + } else { + long averageStartupTime = totalStartupTime / (TOTAL_NUMBER_OF_STARTUP -1); + out.write(startupTag + "\n"); + out.write("Number of loop: " + (TOTAL_NUMBER_OF_STARTUP -1) + "\n"); + out.write(individualStartupTime + "\n\n"); + out.write("Average startup time :" + averageStartupTime + " ms\n\n"); + } out.close(); fstream.close(); } catch (Exception e) { @@ -94,29 +99,41 @@ public class CameraStartUp extends InstrumentationTestCase { individualStartupTime = "Individual Video Startup Time = "; long totalStartupTime = 0; long startupTime = 0; - for ( int i =0; i< TOTAL_NUMBER_OF_STARTUP; i++){ - startupTime = launchVideo(); - totalStartupTime += startupTime; - individualStartupTime += startupTime + " ,"; + for (int i = 0; i < TOTAL_NUMBER_OF_STARTUP; i++) { + if (i == 0) { + // Capture the first startup time individually + long firstStartUpTime = launchVideo(); + writeToOutputFile("First Video Startup: ", firstStartUpTime, "na", true); + } else { + startupTime = launchVideo(); + totalStartupTime += startupTime; + individualStartupTime += startupTime + " ,"; + } } Log.v(TAG, "totalStartupTime =" + totalStartupTime); writeToOutputFile("Video Recorder Startup Time: ", totalStartupTime, - individualStartupTime); + individualStartupTime, false); } @LargeTest public void testLaunchCamera() throws Exception { String individualStartupTime; individualStartupTime = "Individual Camera Startup Time = "; - long totalStartupTime =0; + long totalStartupTime = 0; long startupTime = 0; - for ( int i =0; i< TOTAL_NUMBER_OF_STARTUP; i++){ - startupTime = launchCamera(); - totalStartupTime += startupTime; - individualStartupTime += startupTime + " ,"; + for (int i = 0; i < TOTAL_NUMBER_OF_STARTUP; i++) { + if (i == 0) { + // Capture the first startup time individually + long firstStartUpTime = launchCamera(); + writeToOutputFile("First Camera Startup: ", firstStartUpTime, "na", true); + } else { + startupTime = launchCamera(); + totalStartupTime += startupTime; + individualStartupTime += startupTime + " ,"; + } } Log.v(TAG, "totalStartupTime =" + totalStartupTime); writeToOutputFile("Camera Startup Time: ", totalStartupTime, - individualStartupTime); + individualStartupTime, false); } } \ No newline at end of file -- cgit v1.1