tracy icon indicating copy to clipboard operation
tracy copied to clipboard

Relax SourceLocationOverflowFailure limit?

Open jacereda opened this issue 1 year ago • 5 comments

Hi,

We're reaching the source locations limit. Could this be relaxed somehow using uint16_t instead of int16_t for the maps? 64k would be enough for our use case.

jacereda avatar Nov 19 '24 17:11 jacereda

No, the other side of the range is also used.

wolfpld avatar Nov 19 '24 17:11 wolfpld

I see... Looks like a big change, but given that ZoneEvent wastes space due to alignment, could it be changed to use something like this that would take the same space?

uint64_t _start;
int32_t _srcloc;
uint32_t _child2;
uint64_t _end_child1;
uint32_t extra;

BTW, looks like SetChild sets the uint16_t _child2 via memcpy( &_child2, &child, 4 ), is that intentional?

jacereda avatar Nov 20 '24 07:11 jacereda

Most of Tracy data structures do not follow the alignment requirements to not waste memory (which should also explain how the memcpy works).

Increasing the amount of source locations would explode the memory requirements in other places, for example this per-captured-thread allocation has to account for all source locations:

td->stackCount = (uint8_t*)m_slab.AllocBig( sizeof( uint8_t ) * 64*1024 );

wolfpld avatar Nov 20 '24 11:11 wolfpld

Understood. I wouldn't mind those per-thread allocations if that meant we could have more zones, but we'll try to reduce the amount of zones.

However, I'm not sure I understood why uint16_t _child2 is copied with a size of 4.

Also, the ZoneEvent struct isn't marked as packed so it should surely be adding some padding around _child2? Or is it setting some compile flag to always pack structs?

jacereda avatar Nov 20 '24 17:11 jacereda

I am also running into this issue, while profiling a game engine that runs an interpreted language. 32k source locations is surprisingly low.

If it can't be increased, could we instead fail silently instead of crashing out? Partial source information is better than no information for my usecase.

amylizzle avatar Dec 11 '24 18:12 amylizzle