Skip to content

Commit

Permalink
Fixed HistoryDictionary to avoid keeping identical timestamps for given
Browse files Browse the repository at this point in the history
ID. The newest value wins.
  • Loading branch information
ilabutin committed Jul 11, 2017
1 parent e87435c commit 008773d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/TraceEvent/TraceUtilities/HistoryDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,20 @@ public void Add(Address id, long startTime, T value, bool isEndRundown = false)

// See if we can jump ahead. Currently we only do this of the first entry,
// But you could imagine using some of the other nodes's skipAhead entries.
if (firstEntry.skipAhead != null && firstEntry.skipAhead.startTime < startTime)
if (firstEntry.skipAhead != null && firstEntry.skipAhead.startTime <= startTime)
entry = firstEntry.skipAhead;

for (; ; )
{
// We found exact match
if (startTime == entry.StartTime)
{
// Just update the value and exit immediately as there is no need to
// update skipAhead or increment count
entry.value = value;
return;
}

if (entry.next == null)
{
entry.next = new HistoryValue(startTime, id, value);
Expand Down

0 comments on commit 008773d

Please sign in to comment.