public static MyProfilerBlock Init(MyObjectBuilder_ProfilerBlock objectBuilder, MyProfiler.MyProfilerObjectBuilderInfo profiler) { MyProfilerBlock.MyProfilerBlockObjectBuilderInfo data = new MyProfilerBlock.MyProfilerBlockObjectBuilderInfo(); data.Id = objectBuilder.Id; data.Key = objectBuilder.Key; data.Invalid = objectBuilder.Invalid; data.TimeFormat = objectBuilder.TimeFormat; data.ValueFormat = objectBuilder.ValueFormat; data.CallFormat = objectBuilder.CallFormat; data.ProcessMemory = objectBuilder.ProcessMemory; data.ManagedMemoryBytes = objectBuilder.ManagedMemoryBytes; data.Miliseconds = objectBuilder.Miliseconds; data.CustomValues = objectBuilder.CustomValues; data.NumCallsArray = objectBuilder.NumCallsArray; data.Children = new List <MyProfilerBlock>(); foreach (MyProfilerBlockKey child in objectBuilder.Children) { data.Children.Add(profiler.ProfilingBlocks[child]); } if (objectBuilder.Parent.File != null) { data.Parent = profiler.ProfilingBlocks[objectBuilder.Parent]; } MyProfilerBlock profilerBlock = profiler.ProfilingBlocks[data.Key]; profilerBlock.Init(data); return(profilerBlock); }
public static MyProfiler Init(MyObjectBuilder_Profiler objectBuilder) { MyProfiler.MyProfilerObjectBuilderInfo data = new MyProfiler.MyProfilerObjectBuilderInfo(); data.ProfilingBlocks = new Dictionary <MyProfilerBlockKey, MyProfilerBlock>(); foreach (var blockOB in objectBuilder.ProfilingBlocks) { data.ProfilingBlocks.Add(blockOB.Key, new MyProfilerBlock()); } foreach (var blockOB in objectBuilder.ProfilingBlocks) { MyObjectBuilder_ProfilerBlock.Init(blockOB, data); } data.RootBlocks = new List <MyProfilerBlock>(); foreach (var blockKey in objectBuilder.RootBlocks) { data.RootBlocks.Add(data.ProfilingBlocks[blockKey]); } data.TotalCalls = objectBuilder.TotalCalls; data.CustomName = objectBuilder.CustomName; data.AxisName = objectBuilder.AxisName; MyProfiler profiler = new MyProfiler(false, data.CustomName, data.AxisName); profiler.Init(data); return(profiler); }
public static MyObjectBuilder_ProfilerBlock GetObjectBuilder(MyProfilerBlock profilerBlock) { MyProfilerBlock.MyProfilerBlockObjectBuilderInfo data = profilerBlock.GetObjectBuilderInfo(); MyObjectBuilder_ProfilerBlock objectBuilder = new MyObjectBuilder_ProfilerBlock(); objectBuilder.Id = data.Id; objectBuilder.Key = data.Key; objectBuilder.Invalid = data.Invalid; objectBuilder.TimeFormat = data.TimeFormat; objectBuilder.ValueFormat = data.ValueFormat; objectBuilder.CallFormat = data.CallFormat; objectBuilder.ProcessMemory = data.ProcessMemory; objectBuilder.ManagedMemoryBytes = data.ManagedMemoryBytes; objectBuilder.Miliseconds = data.Miliseconds; objectBuilder.CustomValues = data.CustomValues; objectBuilder.NumCallsArray = data.NumCallsArray; objectBuilder.Children = new List <MyProfilerBlockKey>(); foreach (var child in data.Children) { objectBuilder.Children.Add(child.Key); } if (data.Parent != null) { objectBuilder.Parent = data.Parent.Key; } return(objectBuilder); }
public static MyObjectBuilder_Profiler GetObjectBuilder(MyProfiler profiler) { MyProfiler.MyProfilerObjectBuilderInfo data = profiler.GetObjectBuilderInfo(); MyObjectBuilder_Profiler objectBuilder = new MyObjectBuilder_Profiler(); objectBuilder.ProfilingBlocks = new List <MyObjectBuilder_ProfilerBlock>(); foreach (var block in data.ProfilingBlocks) { objectBuilder.ProfilingBlocks.Add(MyObjectBuilder_ProfilerBlock.GetObjectBuilder(block.Value)); } objectBuilder.RootBlocks = new List <MyProfilerBlockKey>(); foreach (MyProfilerBlock block in data.RootBlocks) { objectBuilder.RootBlocks.Add(block.Key); } objectBuilder.TotalCalls = data.TotalCalls; objectBuilder.CustomName = data.CustomName; objectBuilder.AxisName = data.AxisName; return(objectBuilder); }