Ticket #10919: clock_patch.py

File clock_patch.py, 2.4 KB (added by Owen Arnold, 6 years ago)
Line 
1diff --git a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp
2index e644f68..20915a2 100644
3--- a/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp
4+++ b/Code/Mantid/Framework/DataHandling/src/LoadNexusProcessed.cpp
5@@ -34,6 +34,8 @@
6 #include "MantidDataObjects/PeakShapeSphericalFactory.h"
7 #include "MantidDataObjects/PeakShape.h"
8 
9+#include <time.h>
10+
11 namespace Mantid {
12 namespace DataHandling {
13 
14@@ -367,6 +369,9 @@ Workspace_sptr LoadNexusProcessed::doAccelleratedMultiPeriodLoading(
15  *  @throw runtime_error Thrown if algorithm cannot execute
16  */
17 void LoadNexusProcessed::exec() {
18+
19+    clock_t startt = clock();
20+
21   progress(0, "Opening file...");
22 
23   // Throws an approriate exception if there is a problem with file access
24@@ -501,6 +506,11 @@ void LoadNexusProcessed::exec() {
25   }
26 
27   m_axis1vals.clear();
28+
29+  clock_t endt = clock();
30+
31+  double diffms = ((endt - startt) * 1000) / CLOCKS_PER_SEC;
32+  g_log.warning() << "All time = " <<  diffms << std::endl;
33 }
34 
35 /**
36@@ -993,8 +1003,13 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) {
37   // Hop to the right point
38   m_cppFile->openPath(entry.path());
39   try {
40+
41+
42+
43     // This loads logs, sample, and instrument.
44     peakWS->loadExperimentInfoNexus(m_cppFile, parameterStr);
45+
46+
47   } catch (std::exception &e) {
48     g_log.information("Error loading Instrument section of nxs file");
49     g_log.information(e.what());
50@@ -1462,8 +1477,19 @@ API::Workspace_sptr LoadNexusProcessed::loadEntry(NXRoot &root,
51   m_cppFile->openPath(mtd_entry.path());
52   try {
53     // This loads logs, sample, and instrument.
54+
55+      clock_t begininst = clock();
56+
57+
58     local_workspace->loadExperimentInfoNexus(
59         m_cppFile, parameterStr); // REQUIRED PER PERIOD
60+
61+
62+    clock_t endinst = clock();
63+
64+    double diffms = ((endinst - begininst) * 1000) / CLOCKS_PER_SEC;
65+    g_log.warning() << "Instrument time = " <<  diffms << std::endl;
66+
67   } catch (std::exception &e) {
68     g_log.information("Error loading Instrument section of nxs file");
69     g_log.information(e.what());
70@@ -1498,6 +1524,7 @@ API::Workspace_sptr LoadNexusProcessed::loadEntry(NXRoot &root,
71   progress(progressStart + 0.2 * progressRange,
72            "Reading the workspace history...");
73 
74+
75   return boost::static_pointer_cast<API::Workspace>(local_workspace);
76 }
77