[ismrmrd] 86/281: Missing read speed test from Michael

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.

commit d8b3f8024c042660761adb49dc848b214075cacf
Author: kvahed <kaveh at vahedipour.de>
Date:   Tue Jan 29 17:10:11 2013 +0100

    Missing read speed test from Michael
---
 examples/c++/read_timing_test.cpp | 84 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/examples/c++/read_timing_test.cpp b/examples/c++/read_timing_test.cpp
new file mode 100644
index 0000000..cfa823f
--- /dev/null
+++ b/examples/c++/read_timing_test.cpp
@@ -0,0 +1,84 @@
+#ifdef WIN32 
+#include <windows.h>
+#else 
+#include <sys/time.h>
+#endif
+
+#include <iostream>
+#include <string>
+
+#include "ismrmrd_hdf5.h"
+
+
+class Timer
+{
+public:
+
+  Timer() { Timer("Timer"); }
+
+  Timer(const char* name) : name_(name) {
+    pre();
+#ifdef WIN32
+    QueryPerformanceFrequency(&frequency_);
+    QueryPerformanceCounter(&start_);
+#else
+    gettimeofday(&start_, NULL);
+#endif
+  }
+
+  virtual ~Timer() {
+    double time_in_us = 0.0;
+    post();
+#ifdef WIN32
+    QueryPerformanceCounter(&end_);
+    time_in_us = (end_.QuadPart * (1.0e6/ frequency_.QuadPart)) - start_.QuadPart * (1.0e6 / frequency_.QuadPart);
+#else
+    gettimeofday(&end_, NULL);
+    time_in_us = ((end_.tv_sec * 1e6) + end_.tv_usec) - ((start_.tv_sec * 1e6) + start_.tv_usec);
+#endif
+    std::cout << name_ << ": " << time_in_us/1000.0 << " ms" << std::endl; std::cout.flush();
+  }
+
+  virtual void pre() { }
+  virtual void post() { }
+
+protected:
+
+#ifdef WIN32
+  LARGE_INTEGER frequency_;
+  LARGE_INTEGER start_;
+  LARGE_INTEGER end_;
+#else
+  timeval start_;
+  timeval end_;
+#endif
+
+  std::string name_;
+};
+
+
+int main(int argc, char** argv)
+{
+  std::cout << "File reader timing test" << std::endl;
+
+  if (argc != 2) {
+    std::cout << "Usage: " << std::endl;
+    std::cout << "  " << argv[0] << " <FILENAME>" << std::endl;
+  } 
+
+  std::cout << "Opening file " << argv[1] << std::endl;
+
+
+  {
+    Timer t("READ TIMER");
+    ISMRMRD::IsmrmrdDataset d(argv[1],"dataset");
+    unsigned int number_of_acquisitions = d.getNumberOfAcquisitions();
+    boost::shared_ptr<ISMRMRD::Acquisition> acq;
+    for (unsigned int i = 0; i < number_of_acquisitions; i++) {
+        acq = d.readAcquisition(i);
+      //We'll just throw the data away here. 
+    }
+  }
+  
+  return 0;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list