@@ -336,52 +336,52 @@ class XmlBenchReader {
336336
337337std::list<std::list<double > > ReadJsonBenchFileEquations (std::string filePath)
338338{
339- std::list<std::list<double > > resultList = std::list<std::list<double > >();
340-
341- FILE *fp;
342- long lSize;
343- char *buffer;
344- int arraySize, i;
345- cJSON *root;
346- cJSON *profileBlocks;
347-
348- fp = fopen ( filePath.c_str () , " rb" );
349- if ( !fp ) perror (filePath.c_str ()),exit (1 );
350-
351- fseek ( fp , 0L , SEEK_END);
352- lSize = ftell ( fp );
353- rewind ( fp );
354-
355- /* allocate memory for entire content */
356- buffer = (char *)calloc ( 1 , lSize+1 );
357- if ( !buffer ) fclose (fp),fputs (" memory alloc fails" ,stderr),exit (1 );
358-
359- /* copy the file into the buffer */
360- if ( 1 !=fread ( buffer , lSize, 1 , fp) )
361- fclose (fp),free (buffer),fputs (" entire read fails" ,stderr),exit (1 );
362-
363- /* do your work here, buffer is a string contains the whole text */
364- root = cJSON_Parse (buffer);
365- profileBlocks = cJSON_GetObjectItem (root," profileBlocks" );
366- arraySize = cJSON_GetArraySize (profileBlocks);
367- for (i = 0 ; i < arraySize; i++)
368- {
369- cJSON *item = cJSON_GetArrayItem (profileBlocks, i);
370- cJSON *idItem = cJSON_GetObjectItem (item, " id" );
371- cJSON *ncallItem = cJSON_GetObjectItem (item, " ncall" );
372- cJSON *timeItem = cJSON_GetObjectItem (item, " time" );
373- std::list<double > tmpLst = std::list<double >();
374-
375- tmpLst.push_back (idItem->valuedouble );
376- tmpLst.push_back (timeItem->valuedouble );
377- tmpLst.push_back (ncallItem->valuedouble );
378- resultList.push_back (tmpLst);
379- }
380-
381- fclose (fp);
382- free (buffer);
383-
384- return resultList;
339+ std::list<std::list<double > > resultList = std::list<std::list<double > >();
340+
341+ FILE *fp;
342+ long lSize;
343+ char *buffer;
344+ int arraySize, i;
345+ cJSON *root;
346+ cJSON *profileBlocks;
347+
348+ fp = fopen ( filePath.c_str () , " rb" );
349+ if ( !fp ) perror (filePath.c_str ()),exit (1 );
350+
351+ fseek ( fp , 0L , SEEK_END);
352+ lSize = ftell ( fp );
353+ rewind ( fp );
354+
355+ /* allocate memory for entire content */
356+ buffer = (char *)calloc ( 1 , lSize+1 );
357+ if ( !buffer ) fclose (fp),fputs (" memory alloc fails" ,stderr),exit (1 );
358+
359+ /* copy the file into the buffer */
360+ if ( 1 !=fread ( buffer , lSize, 1 , fp) )
361+ fclose (fp),free (buffer),fputs (" entire read fails" ,stderr),exit (1 );
362+
363+ /* do your work here, buffer is a string contains the whole text */
364+ root = cJSON_Parse (buffer);
365+ profileBlocks = cJSON_GetObjectItem (root," profileBlocks" );
366+ arraySize = cJSON_GetArraySize (profileBlocks);
367+ for (i = 0 ; i < arraySize; i++)
368+ {
369+ cJSON *item = cJSON_GetArrayItem (profileBlocks, i);
370+ cJSON *idItem = cJSON_GetObjectItem (item, " id" );
371+ cJSON *ncallItem = cJSON_GetObjectItem (item, " ncall" );
372+ cJSON *timeItem = cJSON_GetObjectItem (item, " time" );
373+ std::list<double > tmpLst = std::list<double >();
374+
375+ tmpLst.push_back (idItem->valuedouble );
376+ tmpLst.push_back (timeItem->valuedouble );
377+ tmpLst.push_back (ncallItem->valuedouble );
378+ resultList.push_back (tmpLst);
379+ }
380+
381+ fclose (fp);
382+ free (buffer);
383+
384+ return resultList;
385385}
386386
387387void * HpcOmBenchmarkExtImpl__readCalcTimesFromXml (const char *filename)
0 commit comments