internal static FatProfilerEntry MakeFatExternal(FatProfilerEntry caller, object key) { var res = MakeFat(caller, key); // add to end is read using (_profilingEntriesAllLock.ReadUsing()) _profilingEntriesAll.Add(new KeyValuePair <GCHandle?, GCHandle>(GCHandle.Alloc(key, GCHandleType.Weak), GCHandle.Alloc(res, GCHandleType.Weak))); return(res); }
static ProfilerData() { _fixed = new FatProfilerEntry[(int)ProfilerFixedEntry.Count]; // add to end is "read" using (_profilingEntriesAllLock.ReadUsing()) for (var i = 0; i < _fixed.Length; i++) { _fixed[i] = new FatProfilerEntry(); _profilingEntriesAll.Add( new KeyValuePair <GCHandle?, GCHandle>(null, GCHandle.Alloc(_fixed[i], GCHandleType.Weak))); } }
private static FatProfilerEntry MakeFat(FatProfilerEntry caller, object key) { if (ProfileBlocksUpdateByOwner && key is MyCubeBlock block) { var identity = MySession.Static?.Players?.TryGetIdentity(block.OwnerId) ?? MySession.Static?.Players?.TryGetIdentity(block.BuiltBy); if (identity != null) { var playerEntry = PlayerEntry(identity)?.GetFat(_blocksKey)?.GetFat(block.BlockDefinition); if (playerEntry != null) { var result = new FatProfilerEntry(caller, playerEntry); try { playerEntry.ChildUpdateTime.Add(key, result); } catch { // Ignore :/ } return(result); } } } if (key is MyCharacter character) { var id = character.GetIdentity(); var playerEntry = id != null?PlayerEntry(id) : null; if (id != null && playerEntry != null) { var result = new FatProfilerEntry(caller, playerEntry); try { playerEntry.ChildUpdateTime.Add(key, result); } catch { // Ignore :/ } return(result); } } return(new FatProfilerEntry(caller)); }
private static SlimProfilerEntry MakeSlim(FatProfilerEntry caller, object key) { return(new SlimProfilerEntry(caller)); }