OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
vector_dist_performance_util.cpp
1/*
2 * vector_dist_performance_util.cpp
3 *
4 * Created on: Feb 14, 2018
5 * Author: i-bird
6 */
7
9
10#include "vector_dist_performance_util.hpp"
11#include "Plot/GoogleChart.hpp"
12#include <boost/property_tree/xml_parser.hpp>
13#include <boost/foreach.hpp>
14#include "util/performance/performance_util.hpp"
15
16
23void StandardPerformanceGraph(std::string file_mean,
24 std::string file_var,
25 std::string file_mean_save,
26 std::string file_var_save,
27 GoogleChart & cg,
33 std::string x_string,
34 std::string y_string,
35 bool use_log)
36{
39 y_ref_mean.load(file_mean);
40 y_ref_dev.load(file_var);
41
42 // warning level
43 openfpm::vector<int> warning_vlevel;
44
45 // Calculation time graphs data
46
51
52 if (names.size() == 0)
53 return;
54
55 for (size_t i = 0 ; i < names.size() ; i++)
56 yn2.add(names.get(i));
57
58 for (size_t i = 0; i < xp.size() ; i++)
59 x.add(xp.get(i));
60
61 yp_mean.save(file_mean_save);
62 yp_dev.save(file_var_save);
63
64 if (y_ref_mean.size() != 0 && yp_mean.size() != 0 && yp_mean.get(0).size() != 0)
65 {
66 // We reconstruct y and yn
67
68 y2.clear();
69 yn2.clear();
70
71 for (size_t i = 0 ; i < yp_mean.get(0).get(0).size() ; i++)
72 {
73 yn2.add(names.get(i));
74 yn2.add("interval");
75 yn2.add("interval");
76 }
77
78 y2.resize(yp_mean.size());
79 for (size_t r = 0; r < yp_mean.size(); r++)
80 {
81 int warning_level = -1;
82
83 y2.get(r).resize(yp_mean.get(r).size());
84 for (size_t k = 0; k < yp_mean.get(r).size(); k++)
85 {
86
87 // Number of graph points
88 for (size_t g = 0 ; g < yp_mean.get(r).get(k).size() ; g++)
89 {
90 // Time for construction hilbert and random
91 y2.get(r).get(k).add(yp_mean.get(r).get(k).get(g));
92 y2.get(r).get(k).add(y_ref_mean.get(r).get(k).get(g) - 3.0*y_ref_dev.get(r).get(k).get(g));
93 y2.get(r).get(k).add(y_ref_mean.get(r).get(k).get(g) + 3.0*y_ref_dev.get(r).get(k).get(g));
94
95 warning_set(warning_level,yp_mean.get(r).get(k).get(g),y_ref_mean.get(r).get(k).get(g),y_ref_dev.get(r).get(k).get(g));
96 }
97 }
98
99 warning_vlevel.add(warning_level);
100 }
101 }
102 else
103 {
104 return;
105 }
106
107 // Calculation time graphs report
108
109 // Google charts options
110 GCoptions options2;
111
112 options2.yAxis = std::string(y_string);
113 options2.xAxis = std::string(x_string);
114 options2.lineWidth = 4;
115
116 for (size_t i = 0; i < y2.size() ; i++)
117 {
118 std::string chart_area;
119 if (warning_vlevel.size() != 0)
120 addchartarea(chart_area,warning_vlevel.get(i));
121
122 if (use_log == true)
123 {options2.more = GC_Y_LOG + "," + GC_ZOOM + chart_area;}
124 else
125 {options2.more = GC_ZOOM + chart_area;}
126
127 options2.title = gnames.get(i);
128 cg.AddLinesGraph(x,y2.get(i),yn2,options2);
129 }
130}
131
132
Small class to produce graph with Google chart in HTML.
void AddLinesGraph(openfpm::vector< X > &x, openfpm::vector< Y > &y, const GCoptions &opt)
Add a simple lines graph.
Implementation of 1-D std::vector like structure.
size_t size()
Stub size.
Google chart options.
std::string xAxis
X axis name.
size_t lineWidth
Width of the line.
std::string more
more
std::string title
Title of the chart.
std::string yAxis
Y axis name.