8 #ifndef OPENFPM_DATA_SRC_PERFORMANCE_HPP_
9 #define OPENFPM_DATA_SRC_PERFORMANCE_HPP_
11 #include "Plot/GoogleChart.hpp"
13 #include "Memleak_check.hpp"
16 #define N_STAT_SMALL 32
19 #ifdef PERFORMANCE_TEST
22 const char * test_dir;
30 BOOST_AUTO_TEST_SUITE( performance )
34 #include "Grid/grid_performance_tests.hpp"
35 #include "Vector/vector_performance_test.hpp"
37 BOOST_AUTO_TEST_SUITE_END()
49 char pdata_commit[41];
50 char devices_commit[41];
52 char vcluster_commit[41];
53 char numeric_commit[41];
60 std::string toHTML(
size_t i)
62 std::stringstream html;
64 html <<
"<div style=\" border-radius: 25px; padding: 20px 20px 20px 20px ;\" >\n\
65 <div style=\"background-color:white; border-radius: 25px;border: 2px solid #000000; padding: 20px;\" >\n\
66 <h4>config " << i <<
"</h4>\n";
67 html <<
"<strong>OpenFPM numeric:</strong> " << numeric_commit <<
"<br>\n";
68 html <<
"<strong>OpenFPM pdata:</strong> " << pdata_commit <<
"<br>\n";
69 html <<
"<strong>OpenFPM vcluster:</strong> " << vcluster_commit <<
"<br>\n";
70 html <<
"<strong>OpenFPM io:</strong> " << io_commit <<
"<br>\n";
71 html <<
"<strong>OpenFPM pdata:</strong> " << pdata_commit <<
"<br>\n";
72 html <<
"<strong>OpenFPM data:</strong> " << data_commit <<
"<br>\n";
73 html <<
"<strong>OpenFPM devices:</strong> " << devices_commit <<
"<br>\n";
86 void getConfig(configuration & conf)
89 std::string out = exec(
"git rev-parse HEAD");
92 for (
size_t i = 0 ; i < 40 ; i++)
93 conf.data_commit[i] = out[i];
97 std::string out2 = exec(
"cd ../../openfpm_devices ; git rev-parse HEAD");
100 for (
size_t i = 0 ; i < 40 ; i++)
101 conf.devices_commit[i] = out2[i];
105 std::string out3 = exec(
"cd ../../openfpm_io ; git rev-parse HEAD");
108 for (
size_t i = 0 ; i < 40 ; i++)
109 conf.io_commit[i] = out3[i];
113 std::string out4 = exec(
"cd ../../openfpm_vcluster ; git rev-parse HEAD");
116 for (
size_t i = 0 ; i < 40 ; i++)
117 conf.vcluster_commit[i] = out4[i];
121 std::string out5 = exec(
"cd ../../ ; git rev-parse HEAD");
124 for (
size_t i = 0 ; i < 40 ; i++)
125 conf.pdata_commit[i] = out5[i];
129 std::string out6 = exec(
"cd ../../openfpm_numerics ; git rev-parse HEAD");
132 for (
size_t i = 0 ; i < 40 ; i++)
133 conf.numeric_commit[i] = out6[i];
150 if (commits.
size() >= MEASURE_SET)
155 getConfig(commits.last());
157 bool saved = commits.save(file);
159 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error saving previous commit \n";
179 if (per_times.
size() == 0)
183 y.resize(per_times.
size());
185 for(
size_t i = 0 ; i < y.size() ; i++)
187 if (y.get(i).size() >= MEASURE_SET)
189 y.get(i).add(per_times.get(i));
210 for (
size_t i = 0 ; i < y_ref.size() ; i++)
217 for (
size_t j = 0 ; j < y_ref.get(i).size() ; j++)
219 if (y_ref.get(i).get(j) < min)
220 min = y_ref.get(i).get(j);
222 if (y_ref.get(i).get(j) > max)
223 max = y_ref.get(i).get(j);
225 average += y_ref.get(i).get(j);
227 average /= y_ref.get(i).
size();
233 for (
size_t j = 0 ; j < y.get(i).size() ; j++)
235 y_ref_sup.last().add((average/y.get(i).get(j) - 1.0) * 100.0);
236 yn.add(
"config " + std::to_string(j));
239 y_ref_sup.last().add((average/min - 1.0) * 100.0);
241 y_ref_sup.last().add((average/max - 1.0) * 100.0);
246 void write_performance_report()
252 std::string per_dir(test_dir);
255 load_and_combine_commit(per_dir + std::string(
"/openfpm_data/prev_commit"),pcommit);
257 std::string config_list;
259 config_list += std::string(
"<h3>Highest configuration number is the latest version</h3>\n");
261 for (
size_t i = 0 ; i < pcommit.
size() ; i++)
262 config_list += pcommit.get(i).toHTML(i);
265 cg.
write(test_dir + std::string(
"/openfpm_data/openfpm_data_performance.html"));
void addHTML(const std::string &html)
Add HTML text.
Small class to produce graph with Google chart in HTML.
void write(std::string file)
It write the graphs on file in html format using Google charts.
Implementation of 1-D std::vector like structure.