Skip to content

Commit b3498ef

Browse files
committed
sweet graphs
Change-Id: I159334c009743a6b5a23bc413aded3fd19d627de Signed-off-by: panacotta <[email protected]>
1 parent a5665ff commit b3498ef

File tree

2 files changed

+22
-58
lines changed

2 files changed

+22
-58
lines changed

papiplot/.settings/language.settings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
66
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
77
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
8-
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="94275984162938619" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
8+
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="101520255990100379" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
99
<language-scope id="org.eclipse.cdt.core.gcc"/>
1010
<language-scope id="org.eclipse.cdt.core.g++"/>
1111
</provider>
@@ -16,7 +16,7 @@
1616
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
1717
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
1818
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
19-
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="94275984162938619" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
19+
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="101520255990100379" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
2020
<language-scope id="org.eclipse.cdt.core.gcc"/>
2121
<language-scope id="org.eclipse.cdt.core.g++"/>
2222
</provider>

papiplot/src/plot.c

Lines changed: 20 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ int main(int argc, char **argv) {
5252
return 0;
5353
}
5454

55-
void plot(char *path, char* actor_name) {
55+
void plot(char *path, char* actor_name, int number_of_actions, int number_of_events) {
5656
int i;
57-
5857
gnuplot_ctrl * h ;
5958
h = gnuplot_init() ;
6059

@@ -63,13 +62,12 @@ void plot(char *path, char* actor_name) {
6362
gnuplot_cmd(h,"add_label(d) = (strstrt(list, d) == 0 ? list=list.' '.d : '')");
6463

6564
gnuplot_cmd(h, "set datafile separator \";\"");
66-
gnuplot_cmd(h, "set xtics rotate by -35");
67-
68-
int number_of_actions = 4; //TODO function that returns number of actions
69-
int number_of_events = get_events_nb(path);
65+
//gnuplot_cmd(h, "set xtics rotate by -35");
66+
gnuplot_cmd(h, "set logscale y");
7067

7168
gnuplot_cmd(h, "set term png size 1680,1050");
72-
gnuplot_cmd(h, "set output \"bar_labels.png\"");
69+
70+
gnuplot_cmd(h, "set output \"papiplot_%s.png\"",actor_name);
7371
gnuplot_cmd(h, "set xlabel \"Actions\"");
7472
gnuplot_cmd(h, "set ylabel \"Number of occurrences\"");
7573

@@ -89,20 +87,14 @@ void plot(char *path, char* actor_name) {
8987
gnuplot_cmd(h, "set xtics nomirror");
9088
gnuplot_cmd(h, "set xtics autofreq");
9189
gnuplot_cmd(h, "set xtics font \"Verdana,8\"");
92-
gnuplot_cmd(h, "set label rotate by 90");
9390
gnuplot_cmd(h, "set grid");
9491

95-
/*gnuplot_cmd(h, "set xtics(\\");
96-
for (i=0;i<(number_of_actions-1);i++)
97-
gnuplot_cmd(h,"\"\" %d,\\",i);
98-
gnuplot_cmd(h,"\"\" %d)",i);*/
99-
10092

10193
gnuplot_cmd(h, "plot \\");
10294
if(number_of_events==1){
10395
i = 0;
104-
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+(d_width*%d)):%d:xtic(2) smooth frequency w boxes title columnhead,\\", path, i, i+3);
105-
//gnuplot_cmd(h, "\"%s\" using (d='|'.strcol(2).'|', add_label(d),index(d)):3:3 smooth frequency w labels rotate by 90 font \",5\" notitle", path);
96+
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(1).'|', add_label(d),index(d))+(d_width*%d)):%d:xtic(1) w boxes title columnhead,\\", path, i, i+2);
97+
gnuplot_cmd(h, "\"%s\" using (d='|'.strcol(1).'|', add_label(d),index(d)):2:2 w labels rotate by 90 font \",5\" notitle", path);
10698
}
10799
else if (number_of_events==0){
108100
printf("nothing to plot\n");
@@ -111,44 +103,21 @@ void plot(char *path, char* actor_name) {
111103
else{
112104
for(i=0;i<number_of_events;i++){
113105
if(i == 0){//first
114-
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+(d_width*%d)):%d:xtic(2) smooth frequency w boxes title columnhead,\\", path, i, i+3);
115-
//gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+(d_width*%d)):%d:%d smooth frequency w labels rotate by 90 font \",5\" notitle,\\", path,i,i+3,i+3);
116-
}
106+
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(1).'|', add_label(d),index(d))+(d_width*%d)):%d:xtic(1) w boxes title columnhead,\\", path, i, i+2);
107+
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(1).'|', add_label(d),index(d))+(d_width*%d)):%d:%d w labels rotate by 90 font \",5\" notitle,\\", path, i, i+2, i+2);
108+
}
117109
else if (i==(number_of_events-1)){//last
118-
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+(d_width*%d)):%d smooth frequency w boxes title columnhead,\\", path, i, i+3);
119-
//gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+d_width*%d):%d:%d smooth frequency w labels rotate by 90 font \",5\" notitle", path,i,i+3,i+3);
110+
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(1).'|', add_label(d),index(d))+(d_width*%d)):%d w boxes title columnhead,\\", path, i, i+2);
111+
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(1).'|', add_label(d),index(d))+(d_width*%d)):%d:%d w labels rotate by 90 font \",5\" notitle", path, i, i+2, i+2);
112+
}
113+
else{
114+
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(1).'|', add_label(d),index(d))+(d_width*%d)):%d w boxes title columnhead,\\", path, i, i+2);
115+
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(1).'|', add_label(d),index(d))+(d_width*%d)):%d:%d w labels rotate by 90 font \",5\" notitle,\\", path, i, i+2, i+2);
120116
}
121-
else
122-
gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d)),index(d)+(d_width*%d)):%d smooth frequency w boxes title columnhead,\\", path, i, i+3);
123-
//gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+(d_width*%d)):%d:%d smooth frequency w labels rotate by 90 font \",5\" notitle,\\", path,i,i+3,i+3);
124117
}
125118
}
126-
119+
//sleep(6);
127120
gnuplot_close(h);
128-
129-
130-
// gnuplot_cmd(h, "plot \\");
131-
132-
// gnuplot_cmd(h, "\"%s\" using (d='|'.strcol(2).'|', add_label(d),index(d)):3:xtic(2) smooth frequency w boxes title columnhead,\\", path);
133-
// gnuplot_cmd(h, "\"%s\" using (d='|'.strcol(2).'|', add_label(d),index(d)):3:3 smooth frequency w labels rotate by 90 font \",5\" notitle,\\", path);
134-
135-
// gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+d_width):4 smooth frequency w boxes title columnhead,\\", path);
136-
// gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+d_width):4:4 smooth frequency w labels rotate by 90 font \",5\" notitle,\\", path);
137-
138-
// gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+d_width*2):5 smooth frequency w boxes title columnhead,\\", path);
139-
// gnuplot_cmd(h, "\"%s\" using ((d='|'.strcol(2).'|', add_label(d),index(d))+d_width*2):5:5 smooth frequency w labels rotate by 90 font \",5\" notitle", path);
140-
141-
142-
// gnuplot_close(h);
143-
// sleep(100);
144-
145-
146-
/* plot "profit.dat" u 1:2 w boxes lc rgb"green" notitle,\
147-
"profit.dat" u ($1+d_width):3 w boxes lc rgb"red" notitle
148-
http://gnuplot-surprising.blogspot.com.es/2011/09/plot-histograms-using-boxes.html
149-
http://gnuplot-surprising.blogspot.com.es/2011/10/add-value-labels-to-top-of-bars-in-bar.html
150-
*/
151-
sleep(50000000);
152121
}
153122

154123
int get_events_nb(char *path) {
@@ -196,24 +165,21 @@ void search_and_plot(char *path) {
196165
}
197166
char * path_to_csv;
198167

199-
int i = 0;
200168
while ((pDirent = readdir(pDir)) != NULL) {
201169
if(is_papioutput(pDirent->d_name)) {
202-
printf("going for %s\n\n",pDirent->d_name);
203170
path_to_csv = malloc(strlen(path)+strlen(pDirent->d_name)+2);
204171
strcpy(path_to_csv, path);
205172
strcat(path_to_csv,"/");
206173
strcat(path_to_csv,pDirent->d_name);
207174
//printf("plot of %s\n", pDirent->d_name);
208175
data = process_data(path, path_to_csv, pDirent->d_name, path_to_totals);
209-
//plot(path_to_csv, pDirent->d_name);
176+
plot(data->proc_file_path, data->actor_name, data->actions_nb, data->actions[0]->events_nb);
177+
//todo generate html file with data
210178
//remove temp files
211-
//free
212-
//struct_test(data[i++]);
179+
free(data);
213180
}
214181
}
215182

216-
//printf("out of the loooop!\n");
217183
closedir (pDir);
218184
return;
219185
}
@@ -318,8 +284,6 @@ event_acum_for_actor* process_data (char* path_todir, char* path_tofile, char* f
318284

319285
fclose(ofile);
320286

321-
struct_test(actor);
322-
323287
//writing events per action
324288
FILE* datafile = fopen(path_todatafile,"w");
325289
fprintf(datafile,"Action;");

0 commit comments

Comments
 (0)