Index: GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 2020)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 2046)
@@ -1178,4 +1178,9 @@
 				 "10000000");
 
+  RegisterOption("Preprocessor.totalTime",
+				 optInt,
+				 "total_time=",
+				 "-1");
+
   RegisterOption("Preprocessor.samplesPerPass",
 				 optInt,
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2045)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2046)
@@ -172,4 +172,5 @@
 	Environment::GetSingleton()->GetIntValue("Preprocessor.samplesPerPass", mSamplesPerPass);
 	Environment::GetSingleton()->GetIntValue("Preprocessor.totalSamples", mTotalSamples);
+	Environment::GetSingleton()->GetIntValue("Preprocessor.totalTime", mTotalTime);
 	Environment::GetSingleton()->GetIntValue("Preprocessor.samplesPerEvaluation",
 											 mSamplesPerEvaluation);
Index: GTP/trunk/Lib/Vis/Preprocessing/src/run_test_arena
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/run_test_arena	(revision 2045)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/run_test_arena	(revision 2046)
@@ -8,5 +8,5 @@
 VIEWCELLS=../data/Arena/viewcells-5000.xml.gz
 
-PREFIX=../work/plots/osp-arena1-1e5
+PREFIX=../work/plots/osp-arena2-1e5
 
 # $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
@@ -19,4 +19,5 @@
 
 $COMMAND -preprocessor=sampling -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
+-total_samples=500000000000 -total_time=12208 \
 -preprocessor_visibility_file=$PREFIX-r-reference.xml \
 -view_cells_filter_max_size=1 -preprocessor_stats=$PREFIX-r-reference.log \
@@ -24,4 +25,5 @@
 
 $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
+ -total_samples=500000000000 -total_time=12208 \
  -rss_distributions=direction -view_cells_filter_max_size=1 \
  -preprocessor_visibility_file=$PREFIX-r-reference-global.xml \
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 2017)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 2046)
@@ -243,4 +243,5 @@
   
 	int mTotalSamples;
+	int mTotalTime;
 	int mSamplesPerPass;
 	int mSamplesPerEvaluation;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 2043)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.cpp	(revision 2046)
@@ -162,16 +162,19 @@
 
 	if (samples - lastEvaluation >= mSamplesPerEvaluation) {
+	  long time = TimeDiff(startTime, GetTime());
 	  mViewCellsManager->PrintPvsStatistics(mStats);
 	  mStats <<
 		"#Pass\n" <<mPass<<endl<<
-		"#Time\n" << TimeDiff(startTime, GetTime())<<endl<<
+		"#Time\n" << time <<endl<<
 		"#TotalSamples\n" <<samples<<endl<<
 		"#RssSamples\n" <<rssSamples<<endl;
 	  lastEvaluation = samples;
-
+	  
 	  if (renderer) {
 		ComputeRenderError();
 	  }
 	  
+	  if (mTotalTime != -1 && time/1000 > mTotalTime)
+		break;
 	}
   }
Index: GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp	(revision 2043)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp	(revision 2046)
@@ -116,8 +116,9 @@
 	
 	if (i - lastEvaluation >= mSamplesPerEvaluation) {
+	  long time = TimeDiff(startTime, GetTime());
 	  mViewCellsManager->PrintPvsStatistics(mStats);
 	  mStats <<
 		"#Pass\n" <<mPass<<endl<<
-		"#Time\n" << TimeDiff(startTime, GetTime())<<endl<<
+		"#Time\n" << time <<endl<<
 		"#TotalSamples\n" <<i<<endl<<
 		"#RssSamples\n" <<totalVssRays<<endl;
@@ -127,5 +128,7 @@
 		ComputeRenderError();
 	  }
-	  
+
+	  if (mTotalTime!= -1 && time/1000 > mTotalTime)
+		break;
 	}
 
