From 9b682c3e4b43e43dcca055f236edad335351cd65 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 2 Dec 2015 18:47:23 +0000
Subject: [PATCH] Added timing information to the vectorization test

---
 tests/testVectorize.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tests/testVectorize.c b/tests/testVectorize.c
index 78124f00e9..074dd14820 100644
--- a/tests/testVectorize.c
+++ b/tests/testVectorize.c
@@ -120,6 +120,7 @@ int main(int argc, char *argv[]) {
   struct runner runner;
   char c;
   static unsigned long long partId = 0;
+  ticks tic, toc, time;
 
   while ((c = getopt(argc, argv, "h:p:r:t:")) != -1) {
     switch (c) {
@@ -172,19 +173,40 @@ int main(int argc, char *argv[]) {
     zero_particle_fields(ci);
     zero_particle_fields(cj);
 
+    tic = getticks();
+
     /* Run the test */
     runner_dopair1_density(&runner, ci, cj);
 
+    toc = getticks();
+    time += toc - tic;
+    
     /* Dump if necessary */
     if (i % 50 == 0) dump_particle_fields("swift_dopair.dat", ci, cj);
   }
 
+  /* Output timing */
+  message("SWIFT calculation took       %lli ticks." , time / runs);
+
   /* Now perform a brute-force version for accuracy tests */
+
+  /* Zero the fields */
   zero_particle_fields(ci);
   zero_particle_fields(cj);
+
+  tic = getticks();
+
+  /* Run the test */
   pairs_all_density(&runner, ci, cj);
+
+  toc = getticks();
+
+  /* Dump */
   dump_particle_fields("brute_force.dat", ci, cj);
 
+  /* Output timing */
+  message("Brute force calculation took %lli ticks." , toc - tic);
+
   /* Clean things to make the sanitizer happy ... */
   clean_up(ci);
   clean_up(cj);
-- 
GitLab