Пример #1
0
        unsafe void LoadTestData(string path, out NativeArray <SampleData> samples, out NativeArray <StackFrameData> stackFrames, Allocator allocator = Allocator.Persistent)
        {
            using (var stream = File.OpenRead(path)) {
                var reader = new RawReader(stream);

                int numSamples = 0;
                reader.Read(&numSamples);
                samples = new NativeArray <SampleData>(numSamples, allocator);
                reader.ReadBytes(samples.GetUnsafePtr(), numSamples * sizeof(SampleData));

                int numStackFrames = 0;
                reader.Read(&numStackFrames);
                stackFrames = new NativeArray <StackFrameData>(numStackFrames, allocator);
                reader.ReadBytes(stackFrames.GetUnsafePtr(), numStackFrames * sizeof(StackFrameData));
            }
        }