mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Treat -1 as the invalid microsecond duration value, not 0
* Some functions can be so quick that they register as a duration of 0. This is expected and we should not end up omitting it when importing or exporting because we think it was missing. As a 64-bit value, losing a bit for signedness is not a problem.
This commit is contained in:
@@ -217,8 +217,9 @@ conservative size estimate was used on creation to avoid seeking to fix-up the s
|
||||
|
||||
DOCUMENT(R"(The duration in microseconds that this chunk took. This is the time for the actual
|
||||
work, not the serialising.
|
||||
Since 0 is a possible value for this (for extremely fast calls), -1 is the invalid/not present value.
|
||||
)");
|
||||
uint64_t durationMicro = 0;
|
||||
int64_t durationMicro = -1;
|
||||
|
||||
DOCUMENT("The point in time when this chunk was recorded, in microseconds since program start.");
|
||||
uint64_t timestampMicro = 0;
|
||||
|
||||
@@ -354,7 +354,7 @@ static ReplayStatus Structured2XML(const char *filename, const RDCFile &file, ui
|
||||
xChunk.append_attribute("threadID") = chunk->metadata.threadID;
|
||||
if(chunk->metadata.timestampMicro)
|
||||
xChunk.append_attribute("timestamp") = chunk->metadata.timestampMicro;
|
||||
if(chunk->metadata.durationMicro)
|
||||
if(chunk->metadata.durationMicro >= 0)
|
||||
xChunk.append_attribute("duration") = chunk->metadata.durationMicro;
|
||||
if(!chunk->metadata.callstack.empty())
|
||||
{
|
||||
|
||||
@@ -431,7 +431,7 @@ void Serialiser<SerialiserMode::Writing>::WriteStructuredFile(const SDFile &file
|
||||
if(m_ChunkMetadata.threadID != 0)
|
||||
m_ChunkFlags |= ChunkThreadID;
|
||||
|
||||
if(m_ChunkMetadata.durationMicro != 0)
|
||||
if(m_ChunkMetadata.durationMicro >= 0)
|
||||
m_ChunkFlags |= ChunkDuration;
|
||||
|
||||
if(m_ChunkMetadata.timestampMicro != 0)
|
||||
|
||||
Reference in New Issue
Block a user