Opened 11 years ago

Last modified 9 years ago

#1939 new defect

[PATCH] Profiler got corrupted: showing all as unlogged

Reported by: Markus Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords: patch
Cc: Yves Patch:

Description

Sometimes the profiles shows bogus values. Everything is zero just the unlogged takes the whole time.

The problem happens when the hierachical profiler is not stopped where its started for. The C++ implementation is safe due to an objects destructor. But the start/stop functions are also exported to JS where the stop seems to be forgotten. So all following profiles are put under this single node in the tree, never stopping the parent and hiding them from the gui.

Attachments (1)

fix-profiler-corruption-recovery.patch (2.7 KB ) - added by Markus 11 years ago.
The output is filtered and normally not displayed. As its an error, removed the filtering.

Download all attachments as: .zip

Change History (14)

comment:1 by Yves, 11 years ago

I think the overall approach isn't bad and I can't think of a better one. I haven't done a "full" review, but here's just one thing I noticed. You changed the normal profiling (CProfileSample) to silently ignore when non-main threads try to use the profiler instead of causing an assertion. Programmers who try using Profiler1 in non-main threads won't notice it if they aren't careful enough. This will only cause unused code and nothing worse, though. If I understand it correctly, that's the whole purpose of the separate CProfileSample and CProfileSampleScript classes. If this little difference isn't important we could as well just scrap one of the classes and avoid duplicated code.

comment:2 by Yves, 11 years ago

Cc: Yves added

comment:3 by Markus, 11 years ago

Regarding "Aegis bot": #1945

by Markus, 11 years ago

The output is filtered and normally not displayed. As its an error, removed the filtering.

comment:4 by historic_bruno, 11 years ago

Owner: set to Markus

comment:5 by Kieran P, 11 years ago

Milestone: Alpha 14Alpha 15

comment:6 by historic_bruno, 10 years ago

I haven't tested the patch, but one thing that needs to be corrected is the printf formatting should use either %hs or %ls for printing C strings.

comment:7 by leper, 10 years ago

Milestone: Alpha 15Alpha 16

comment:8 by leper, 10 years ago

Milestone: Alpha 16Alpha 17

comment:9 by Itms, 10 years ago

Milestone: Alpha 17Alpha 18

comment:10 by historic_bruno, 9 years ago

The patch seems to detect incorrect profiling calls, as a test I removed a ProfileStart from Petra AI. However, the profiler consistently crashes after that:

PROFILER: Current not right: Should be "AI script" but is "sim update"
PROFILER: Skip "sim update". This profiler was not stopped correctly!
PROFILER: Did not find the right callee in the stack but reached root: Performing reset.
First-chance exception at 0x001c954c in pyrogenesis.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x001c954c in pyrogenesis.exe: 0xC0000005: Access violation reading location 0x00000000.

The same crash occurs without the patch, so it's difficult to tell how the patch helps.

comment:11 by historic_bruno, 9 years ago

Keywords: review removed

comment:12 by historic_bruno, 9 years ago

Milestone: Alpha 18Backlog

comment:13 by historic_bruno, 9 years ago

Owner: Markus removed
Note: See TracTickets for help on using tickets.