diff --git a/runtime/src/katracereader.cpp b/runtime/src/katracereader.cpp index c4c2ce93836a069a642a89857b8595beb1b3e53b..a0578ecb20b6d0caf10c0542010f94e9d99e8834 100644 --- a/runtime/src/katracereader.cpp +++ b/runtime/src/katracereader.cpp @@ -2473,7 +2473,7 @@ int csv_parallel_region_t::closefile(int cpucount) /* header */ fprintf(csv_parallel_region_t::fout, - "Resource, Numa, Start, End, Duration, Explicit, Aff, Strict, Tag, Name, TaskId" + "Resource,Numa,Start,End,Duration,Explicit,Aff,Strict,Tag,Name,TaskId" ); if (!kaapi_perf_idset_empty(&rastello_header.task_perf_mask)) { @@ -2482,7 +2482,7 @@ int csv_parallel_region_t::closefile(int cpucount) { if (kaapi_perf_idset_test(&rastello_header.task_perf_mask, i)) { - fprintf(csv_parallel_region_t::fout, ", %s", rastello_header.perfcounter_name[i] ); + fprintf(csv_parallel_region_t::fout, ",%s", rastello_header.perfcounter_name[i] ); } } } @@ -2514,7 +2514,7 @@ int csv_parallel_region_t::closefile(int cpucount) /* csv header */ fprintf(csv_parallel_region_t::fout_complexity, - "Start, Tc, Work, Task\n" + "Start,Tc,Work,Task\n" ); } struct pair { @@ -2529,7 +2529,7 @@ int csv_parallel_region_t::closefile(int cpucount) { std::vector<pair> values; task_info* task = *ribeg; - pair remain = {task->stop, 0ULL, 0ULL}; + pair remain = {task->stop,0ULL, 0ULL}; values.resize( container_orderedlist.size()+1); size_t pos = container_orderedlist.size(); values[pos--] = remain; @@ -2548,7 +2548,7 @@ int csv_parallel_region_t::closefile(int cpucount) for (pos=0; pos< values.size(); ++pos) { fprintf(csv_parallel_region_t::fout_complexity, - "%" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 "\n", + "%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%" PRIu64 "\n", values[pos].stamp, values[pos].tc, values[pos].work, @@ -2579,21 +2579,21 @@ int csv_parallel_region_t::closefile(int cpucount) { case threadstate_t::STATE: fprintf(csv_parallel_region_t::fout_threads, - "%i, STATE, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %i, %i,,\n", + "%i,STATE,%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%i,%i,,\n", ts.kid, ts.start, ts.stop, ts.delay(), ts.value, ts.cpu, ts.node ); break; case threadstate_t::POP: fprintf(csv_parallel_region_t::fout_threads, - "%i, POP, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %i, %i, %i, %i\n", + "%i,POP,%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%i,%i,%i,%i\n", ts.kid, ts.start, ts.stop, ts.delay(), ts.value, ts.cpu, ts.node, ts.victim_level, ts.victim_id ); break; case threadstate_t::STEAL: fprintf(csv_parallel_region_t::fout_threads, - "%i, STEAL, %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %i, %i, %i, %i\n", + "%i,STEAL,%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%i,%i,%i,%i\n", ts.kid, ts.start, ts.stop, ts.delay(), ts.value, ts.cpu, ts.node, ts.victim_level, ts.victim_id ); @@ -2618,13 +2618,13 @@ int csv_parallel_region_t::closefile(int cpucount) } /* header */ fprintf(csv_parallel_region_t::fout_loops, - "Resource, Stamp, Wid, EvtType, UB, LB, Stride\n" + "Resource,Stamp,Wid,EvtType,UB,LB,Stride\n" ); for (size_t i=0; i<loopevts.size(); ++i) { loopinfo_t& li = loopevts[i]; fprintf(csv_parallel_region_t::fout_loops, - "%i, %" PRIu64 ", %" PRIu64 ", %i, %" PRIi64 ", %" PRIi64 ", %" PRIi64 "\n", + "%i,%" PRIu64 ",%" PRIu64 ",%i,%" PRIi64 ",%" PRIi64 ",%" PRIi64 "\n", li.kid, li.start, li.wid, li.type, li.ub, li.lb, li.stride ); @@ -2646,20 +2646,68 @@ int csv_parallel_region_t::closefile(int cpucount) } /* header */ fprintf(csv_parallel_region_t::fout_memory, - "Resource, Stamp, TaskId, Type, Size\n" + "Resource,Stamp,TaskId,Type,Size\n" ); } for (size_t i=0; i<memoryevts.size(); ++i) { memoryinfo_t& li = memoryevts[i]; fprintf(csv_parallel_region_t::fout_memory, - "%i, %" PRIu64 ", %" PRIu64 ", %i, %" PRIi64 "\n", + "%i,%" PRIu64 ",%" PRIu64 ",%i,%" PRIi64 "\n", li.kid, li.start, li.task, li.type, li.size ); } fflush(csv_parallel_region_t::fout_memory); + if (csv_parallel_region_t::fout_counter ==0) + { + char filename[128]; + sprintf(filename, "counters.csv"); + csv_parallel_region_t::fout_counter = fopen(filename,"w"); + if (csv_parallel_region_t::fout_counter ==0) + { + fprintf(stderr,"*** Cannot open file '%s'\n",filename); + exit(-1); + } + /* header */ + fprintf(csv_parallel_region_t::fout_counter, + "Id,Name\n" + ); + int count_perfcounter = rastello_header.perfcounter_count & 0xFF; + for (unsigned int i=0; i< count_perfcounter; ++i) + { + if (kaapi_perf_idset_test(&rastello_header.perf_mask, i)) + { + fprintf(csv_parallel_region_t::fout_counter, "%i,%s", i, rastello_header.perfcounter_name[i] ); + } + } + fclose(csv_parallel_region_t::fout_counter); + csv_parallel_region_t::fout_counter = 0; + + sprintf(filename, "uncoreperfctr.csv"); + csv_parallel_region_t::fout_counter = fopen(filename,"w"); + if (csv_parallel_region_t::fout_counter ==0) + { + fprintf(stderr,"*** Cannot open file '%s'\n",filename); + exit(-1); + } + /* header */ + fprintf(csv_parallel_region_t::fout_counter, + "Resource,Stamp,Id,Value\n" + ); + } + for (size_t i=0; i<uncoreevts.size(); ++i) + { + uncoreperfctr_t& ei = uncoreevts[i]; + fprintf(csv_parallel_region_t::fout_counter, + "%i,%" PRIu64 ",%i,%" PRIi64 "\n", + ei.numaid, ei.start, ei.idx, ei.value + ); + } + fflush(csv_parallel_region_t::fout_memory); + + /* reset state of the parallel region */ threadstates.clear(); loopstates.clear();