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)
Change History (14)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Cc: | added |
---|
by , 11 years ago
Attachment: | fix-profiler-corruption-recovery.patch added |
---|
The output is filtered and normally not displayed. As its an error, removed the filtering.
comment:4 by , 11 years ago
Owner: | set to |
---|
comment:5 by , 11 years ago
Milestone: | Alpha 14 → Alpha 15 |
---|
comment:6 by , 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 , 10 years ago
Milestone: | Alpha 15 → Alpha 16 |
---|
comment:8 by , 10 years ago
Milestone: | Alpha 16 → Alpha 17 |
---|
comment:9 by , 10 years ago
Milestone: | Alpha 17 → Alpha 18 |
---|
comment:10 by , 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 , 9 years ago
Keywords: | review removed |
---|
comment:12 by , 9 years ago
Milestone: | Alpha 18 → Backlog |
---|
comment:13 by , 9 years ago
Owner: | removed |
---|
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.