From bc6c6fc4863516d43a1ea27aaaecc93c7ea8a8b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 17 Mar 2017 22:49:01 +0100
Subject: [PATCH] Removed remaining calls or references to cputime.

---
 matlab/cycle_reduction.m            | 8 ++++----
 matlab/utilities/tests              | 2 +-
 tests/Makefile.am                   | 4 ++--
 tests/run_all_unitary_tests.m       | 2 +-
 tests/run_block_byte_tests_matlab.m | 6 +++---
 tests/run_block_byte_tests_octave.m | 6 +++---
 tests/run_reporting_test_matlab.m   | 2 +-
 tests/run_reporting_test_octave.m   | 2 +-
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/matlab/cycle_reduction.m b/matlab/cycle_reduction.m
index 019c39a190..59cdc5717d 100644
--- a/matlab/cycle_reduction.m
+++ b/matlab/cycle_reduction.m
@@ -125,8 +125,8 @@ end
 %$
 %$ % Solve the equation with the cycle reduction algorithm
 %$ try
-%$     t=cputime; X1 = cycle_reduction(C,B,A,1e-7); elapsedtime = cputime-t;
-%$     disp(['cputime for cycle reduction algorithm is: ' num2str(elapsedtime) ' (n=' int2str(n) ').'])
+%$     tic; X1 = cycle_reduction(C,B,A,1e-7); elapsedtime = toc;
+%$     disp(['Elapsed time for cycle reduction algorithm is: ' num2str(elapsedtime) ' (n=' int2str(n) ').'])
 %$     t(1) = 1;
 %$ catch
 %$     % nothing to do here.
@@ -134,8 +134,8 @@ end
 %$
 %$ % Solve the equation with the logarithmic reduction algorithm
 %$ try
-%$     t=cputime; X2 = logarithmic_reduction(A,B,C,1e-16,100); elapsedtime = cputime-t;
-%$     disp(['cputime for logarithmic reduction algorithm is: ' num2str(elapsedtime) ' (n=' int2str(n) ').'])
+%$     tic; X2 = logarithmic_reduction(A,B,C,1e-16,100); elapsedtime = toc;
+%$     disp(['Elapsed time for logarithmic reduction algorithm is: ' num2str(elapsedtime) ' (n=' int2str(n) ').'])
 %$     t(2) = 1;
 %$ catch
 %$     % nothing to do here.
diff --git a/matlab/utilities/tests b/matlab/utilities/tests
index b2a8b9c059..9e1c32322f 160000
--- a/matlab/utilities/tests
+++ b/matlab/utilities/tests
@@ -1 +1 @@
-Subproject commit b2a8b9c059b1e2cb119e8d5fa92b4388fd93c9dd
+Subproject commit 9e1c32322ff46c661068fbb1f0a1e4ebb83d136f
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6692641575..874d44a3ba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -834,7 +834,7 @@ check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
 	@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
 		$(MATLAB)/bin/matlab -nosplash -nodisplay -r run_test_matlab > $*.m.log  2> /dev/null || \
-	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:cputime: 0.0\n" > $*.m.trs
+	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.m.trs
 	@if grep -q ":test-result: PASS" $*.m.trs; then \
 	echo "`tput bold``tput setaf 2`MATLAB: $(PWD)/$* PASSED!`tput sgr0`" ; \
 	else \
@@ -854,7 +854,7 @@ check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
 	@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`"
 	@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
 		$(OCTAVE) --no-init-file --silent --no-history --path "$*.mod" run_test_octave.m > $*.o.log 2>&1 || \
-	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:cputime: 0.0\n" > $*.o.trs
+	printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.o.trs
 	@if grep -q ":test-result: PASS" $*.o.trs; then \
 	echo "`tput bold``tput setaf 2`OCTAVE: $(PWD)/$* PASSED!`tput sgr0`" ; \
 	else \
diff --git a/tests/run_all_unitary_tests.m b/tests/run_all_unitary_tests.m
index 34ab08a211..b31f9d8ada 100644
--- a/tests/run_all_unitary_tests.m
+++ b/tests/run_all_unitary_tests.m
@@ -82,7 +82,7 @@ else
   fprintf(fid,':number-tests: %d\n', counter);
   fprintf(fid,':number-failed-tests: 0\n');
 end
-fprintf(fid,':cputime: %f\n',0.0);
+fprintf(fid,':elapsed-time: %f\n',0.0);
 fclose(fid);
 if ~isoctave
     exit
diff --git a/tests/run_block_byte_tests_matlab.m b/tests/run_block_byte_tests_matlab.m
index 530d2f7a8c..846beadecf 100644
--- a/tests/run_block_byte_tests_matlab.m
+++ b/tests/run_block_byte_tests_matlab.m
@@ -38,7 +38,7 @@ failedBlock = {};
 num_block_tests = 0;
 cd([top_test_dir filesep 'block_bytecode']);
 has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
-cput = cputime;
+tic;
 for blockFlag = 0:1
     for bytecodeFlag = 0:1
         default_solve_algo = 2;
@@ -129,7 +129,7 @@ for blockFlag = 0:1
         end
     end
 end
-ecput = cputime - cput;
+ecput = toc;
 delete('wsMat.mat')
 cd(getenv('TOP_TEST_DIR'));
 fid = fopen('run_block_byte_tests_matlab.m.trs', 'w+');
@@ -143,6 +143,6 @@ else
   fprintf(fid,':number-tests: %d\n', num_block_tests);
   fprintf(fid,':number-failed-tests: 0\n');
 end
-fprintf(fid,':cputime: %f\n', ecput);
+fprintf(fid,':elapsed-time: %f\n', ecput);
 fclose(fid);
 exit;
diff --git a/tests/run_block_byte_tests_octave.m b/tests/run_block_byte_tests_octave.m
index a915e97526..288a17e942 100644
--- a/tests/run_block_byte_tests_octave.m
+++ b/tests/run_block_byte_tests_octave.m
@@ -40,7 +40,7 @@ putenv("GNUTERM", "dumb")
 failedBlock = {};
 num_block_tests = 0;
 cd([top_test_dir filesep 'block_bytecode']);
-cput = cputime;
+tic;
 for blockFlag = 0:1
     for bytecodeFlag = 0:1
         ## Recall that solve_algo=7 and stack_solve_algo=2 are not supported
@@ -131,7 +131,7 @@ for blockFlag = 0:1
         endfor
     endfor
 endfor
-ecput = cputime - cput;
+ecput = toc;
 delete('wsOct');
 cd(getenv('TOP_TEST_DIR'));
 fid = fopen('run_block_byte_tests_octave.o.trs', 'w+');
@@ -145,7 +145,7 @@ else
   fprintf(fid,':number-tests: %d\n', num_block_tests);
   fprintf(fid,':number-failed-tests: 0\n');
 end
-fprintf(fid,':cputime: %f\n', ecput);
+fprintf(fid,':elapsed-time: %f\n', ecput);
 fclose(fid);
 ## Local variables:
 ## mode: Octave
diff --git a/tests/run_reporting_test_matlab.m b/tests/run_reporting_test_matlab.m
index e5729c7321..3c5ccb95de 100644
--- a/tests/run_reporting_test_matlab.m
+++ b/tests/run_reporting_test_matlab.m
@@ -54,6 +54,6 @@ else
   fprintf(fid,':number-failed-tests: 0\n');
   fprintf(fid,':list-of-passed-tests: run_reporting_test_matlab.m\n');
 end
-fprintf(fid,':cputime: %f\n',0.0);
+fprintf(fid,':elapsed-time: %f\n',0.0);
 fclose(fid);
 exit;
diff --git a/tests/run_reporting_test_octave.m b/tests/run_reporting_test_octave.m
index 43c6067fcf..32edcfb630 100644
--- a/tests/run_reporting_test_octave.m
+++ b/tests/run_reporting_test_octave.m
@@ -60,7 +60,7 @@ else
   fprintf(fid,':number-failed-tests: 0\n');
   fprintf(fid,':list-of-passed-tests: run_reporting_test_octave.m\n');
 end
-fprintf(fid,':cputime: %f\n',0.0);
+fprintf(fid,':elapsed-time: %f\n',0.0);
 fclose(fid);
 
 ## Local variables:
-- 
GitLab