comparison Histogram.c @ 21:4d9af65ad3df

removed print-to-file hack that wasn't generic and fixed include paths
author Some Random Person <seanhalle@yahoo.com>
date Fri, 09 Mar 2012 22:16:40 -0800
parents f4d96eaf374a
children 6cee2e00eacb
comparison
equal deleted inserted replaced
12:f182ad11c6fa 14:6d346538f788
6 * 6 *
7 */ 7 */
8 #include <stdio.h> 8 #include <stdio.h>
9 #include "Histogram.h" 9 #include "Histogram.h"
10 10
11 //External variables for saving of the histogram
12 //These have to be defined by to plugins in order to enable VMS to print this
13 //information to the histogram file
14 extern char __ProgrammName[]; //Defined in main.c
15 extern char __Scheduler[]; //Defined in VPThread_PluginFns.c
16 extern char __DataSet[255];
17 11
18 /*This Histogram Abstract Data Type has a number of bins plus a range of 12 /*This Histogram Abstract Data Type has a number of bins plus a range of
19 * values that the bins span, both chosen at creation. 13 * values that the bins span, both chosen at creation.
20 * 14 *
21 *One creates a Histogram instance using the makeHistogram function, then 15 *One creates a Histogram instance using the makeHistogram function, then
211 if(output == NULL){ 205 if(output == NULL){
212 printf("[!]No histogram was saved. To save histograms create folder 'histograms'.\n"); 206 printf("[!]No histogram was saved. To save histograms create folder 'histograms'.\n");
213 return; 207 return;
214 } 208 }
215 209
216 /*
217 * Write the header of the measurement file.
218 */
219 //--------------------------
220 //Build Environment
221 fprintf(output, "# >> Build Environment <<\n");
222 fprintf(output, "# Hardware Architecture: ");
223 #ifdef __x86_64
224 fprintf(output, "x86_64");
225 #endif //__x86_64
226 #ifdef __i386
227 fprintf(output, "x86");
228 #endif //__i386
229 fprintf(output, "\n");
230 fprintf(output, "# GCC VERSION: %d.%d.%d\n",__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
231 fprintf(output, "# Build Date: %s %s\n", __DATE__, __TIME__);
232 fprintf(output, "# Number of Cores: %d\n", NUM_CORES);
233 //--------------------------
234
235 //--------------------------
236 //VMS Plugins
237 fprintf(output, "#\n# >> VMS Plugins <<\n");
238 fprintf(output, "# Language : ");
239 #ifdef VPTHREAD
240 fprintf(output, "VPThread");
241 #endif
242 #ifdef VCILK
243 fprintf(output, "VCilk");
244 #endif
245 #ifdef SSR
246 fprintf(output, "SSR");
247 #endif
248 fprintf(output, "\n");
249 fprintf(output, "# Scheduler: %s\n", __Scheduler);
250
251 //--------------------------
252 //Application
253 fprintf(output, "#\n# >> Application <<\n");
254 fprintf(output, "# Name: %s\n", __ProgrammName);
255 fprintf(output, "# Data Set:\n%s\n",__DataSet);
256
257 //--------------------------
258 //Histogram
259 fprintf(output, "#\n# Histogram Name: %s\n", hist->name); 210 fprintf(output, "#\n# Histogram Name: %s\n", hist->name);
260 fprintf(output, "# Expected Values\n"); 211 fprintf(output, "# Expected Values\n");
261 fprintf(output, "#\tnum samples: %d | expected value: %3.2f \n", 212 fprintf(output, "#\tnum samples: %d | expected value: %3.2f \n",
262 (int)total, expectedValue1 ); 213 (int)total, expectedValue1 );
263 fprintf(output, "#\tminus top bin, num samples: %d | expected value: %3.2f \n", 214 fprintf(output, "#\tminus top bin, num samples: %d | expected value: %3.2f \n",