1
0
forked from 0ad/0ad

Fix a double to float coercion and JS errors with empty threads in Profiler2 . Refs #4056

This was SVN commit r18424.
This commit is contained in:
wraitii 2016-06-22 16:46:49 +00:00
parent 3cbe96d24c
commit 490ee7387f
3 changed files with 8 additions and 3 deletions

View File

@ -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;

View File

@ -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 };

View File

@ -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)