----------------------------------------------------------------------
| 200 | |
| 201 | // ---------------------------------------------------------------------- |
| 202 | BLProfStats::TimeRange RegionsProfStats::MakeRegionPlt(FArrayBox &rFab, int noregionnumber, |
| 203 | int width, int height, |
| 204 | Vector<Vector<Box>> ®ionBoxes) |
| 205 | { |
| 206 | amrex::ignore_unused(noregionnumber); |
| 207 | |
| 208 | #if (BL_SPACEDIM != 2) |
| 209 | cout << "**** Error: RegionsProfStats::MakeRegionPlt only supported for 2D" << endl; |
| 210 | return TimeRange(0, 0); |
| 211 | #else |
| 212 | BL_PROFILE("RegionsProfStats::MakeRegionPlt()"); |
| 213 | int xLength(width), yHeight(height); |
| 214 | int nRegions(maxRNumber + 1); |
| 215 | int whichProc(ParallelDescriptor::IOProcessorNumber()); |
| 216 | Real notInRegionValue(-1.0); |
| 217 | Box b(IntVect(0, 0), IntVect(xLength - 1, (yHeight * nRegions) - 1)); |
| 218 | rFab.resize(b, 1); |
| 219 | rFab.setVal<RunOn::Host>(notInRegionValue); |
| 220 | |
| 221 | Vector<Real> rStartTime(nRegions, -1.0); |
| 222 | regionBoxes.clear(); |
| 223 | regionBoxes.resize(nRegions); |
| 224 | |
| 225 | // need a better way to get the real minmax time |
| 226 | Real timeMax(-std::numeric_limits<Real>::max()); |
| 227 | for(int idb(0); idb < dataBlocks.size(); ++idb) { |
| 228 | DataBlock &dBlock = dataBlocks[idb]; |
| 229 | timeMax = std::max(timeMax, dBlock.timeMax); |
| 230 | if(dBlock.proc == whichProc) { |
| 231 | ReadBlock(dBlock, true, false); // dont need to read the trace data |
| 232 | for(int iss(0); iss < dBlock.rStartStop.size(); ++iss) { |
| 233 | BLProfiler::RStartStop &rss = dBlock.rStartStop[iss]; |
| 234 | timeMax = std::max(timeMax, rss.rssTime); |
| 235 | } |
| 236 | ClearBlock(dBlock); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | for(int idb(0); idb < dataBlocks.size(); ++idb) { |
| 241 | DataBlock &dBlock = dataBlocks[idb]; |
| 242 | if(dBlock.proc != whichProc) { |
| 243 | continue; |
| 244 | } |
| 245 | ReadBlock(dBlock, true, false); // dont need to read the trace data |
| 246 | |
| 247 | for(int i(0); i < dBlock.rStartStop.size(); ++i) { |
| 248 | BLProfiler::RStartStop &rss = dBlock.rStartStop[i]; |
| 249 | if(rss.rssStart) { // start region |
| 250 | if(rStartTime[rss.rssRNumber] < 0.0) { // not started yet |
| 251 | rStartTime[rss.rssRNumber] = rss.rssTime; |
| 252 | } else { // already started, mismatched start/stop |
| 253 | } |
| 254 | } else { // stop region |
| 255 | if(rStartTime[rss.rssRNumber] < 0.0) { // not started yet, mismatched start/stop |
| 256 | } else { // stopping |
| 257 | Real rtStart(rStartTime[rss.rssRNumber]), rtStop(rss.rssTime); |
| 258 | rStartTime[rss.rssRNumber] = -1.0; |
| 259 | int xStart = int(xLength * rtStart / timeMax); |
no test coverage detected