diff --git a/source/ps/Profiler2.cpp b/source/ps/Profiler2.cpp index a8e54febc2..b44e140c3c 100644 --- a/source/ps/Profiler2.cpp +++ b/source/ps/Profiler2.cpp @@ -587,7 +587,7 @@ void rewriteBuffer(u8* buffer, u32& bufferSize) double curTime = initialTime; // the region enter { - CProfiler2::SItem_dt_id item = { curTime, regionName }; + CProfiler2::SItem_dt_id item = { (float)curTime, regionName }; buffer[writePos] = (u8)CProfiler2::ITEM_ENTER; memcpy(buffer + writePos + 1, &item, sizeof(item)); writePos += sizeof(item) + 1; @@ -597,7 +597,7 @@ void rewriteBuffer(u8* buffer, u32& bufferSize) // sub-events, aggregated for (auto& type : timeByType) { - CProfiler2::SItem_dt_id item = { curTime, std::get<0>(type.second) }; + CProfiler2::SItem_dt_id item = { (float)curTime, std::get<0>(type.second) }; buffer[writePos] = (u8)CProfiler2::ITEM_ENTER; memcpy(buffer + writePos + 1, &item, sizeof(item)); writePos += sizeof(item) + 1; @@ -628,7 +628,7 @@ void rewriteBuffer(u8* buffer, u32& bufferSize) } // Time of computation { - CProfiler2::SItem_dt_id item = { curTime, "CondenseBuffer" }; + CProfiler2::SItem_dt_id item = { (float)curTime, "CondenseBuffer" }; buffer[writePos] = (u8)CProfiler2::ITEM_ENTER; memcpy(buffer + writePos + 1, &item, sizeof(item)); writePos += sizeof(item) + 1; diff --git a/source/tools/profiler2/Profiler2Report.js b/source/tools/profiler2/Profiler2Report.js index 72992fba52..920379b57d 100644 --- a/source/tools/profiler2/Profiler2Report.js +++ b/source/tools/profiler2/Profiler2Report.js @@ -190,6 +190,8 @@ function process_raw_data(data, range) stack.pop(); } } + if (!frames.length) + return { 'frames': [], 'events': [], 'intervals': [], 'intervals_by_type' : {}, 'tmin': 0, 'tmax': 0 }; if(!range) { range = { "tmin" : frames[0].t0, "tmax" : frames[frames.length-1].t1 }; diff --git a/source/tools/profiler2/utilities.js b/source/tools/profiler2/utilities.js index a2e9f7f67a..a1960b7af4 100644 --- a/source/tools/profiler2/utilities.js +++ b/source/tools/profiler2/utilities.js @@ -86,6 +86,9 @@ function time_label(t, precision = 2) function slice_intervals(data, range) { + if (!data.frames.length) + return {"tmin":0,"tmax":0,"intervals":[]}; + var tmin = 0; var tmax = 0; if (range.seconds)