Ejemplo n.º 1
0
    public GraphStream GetRecordingStream(int count, int graphId)
    {
        // the native doesn't like if the count is 0, and default(NativeStreamWriter) in a job would trigger a safety check error
        var recordingStream = new GraphStream(graphId, new NativeStream(math.max(1, count), Allocator.Persistent), new JobHandle());

        return(recordingStream);
    }
    public void WriteBoolWorks()
    {
        ulong nodeGuid1 = 1;
        ulong nodeGuid2 = 2;

        GraphStream stream = new GraphStream(1, new NativeStream(1, Allocator.Persistent), new JobHandle());

        try
        {
            var writer = stream.AsWriter();
            writer.BeginForEachIndex(new Entity {
                Index = 42
            }, 0, nodeGuid1, nodeGuid2);
            var value = true;
            writer.Record(value, nodeGuid1, nodeGuid2);
            writer.EndForEachIndex();

            var reader = stream.NativeStream.AsReader();

            reader.BeginForEachIndex(0);
            Assert.AreEqual(TracingRecorderSystem.DataType.Entity, reader.Read <TracingRecorderSystem.DataType>());
            var entity = TracingRecorderSystem.ReadEntity(ref reader);
            Assert.AreEqual(42, entity.Index);

            ulong guid1, guid2;
            Assert.AreEqual(TracingRecorderSystem.DataType.Step, reader.Read <TracingRecorderSystem.DataType>());
            TracingRecorderSystem.ReadStepRecord(ref reader, out guid1, out guid2, out var offset, out _);
            Assert.AreEqual(nodeGuid1, guid1);
            Assert.AreEqual(nodeGuid2, guid2);
            Assert.AreEqual(0, offset);

            Assert.AreEqual(TracingRecorderSystem.DataType.Data, reader.Read <TracingRecorderSystem.DataType>());
            TracingRecorderSystem.ReadValueRecord(ref reader, out guid1, out guid2, out var readValue);
            Assert.AreEqual(nodeGuid1, guid1);
            Assert.AreEqual(nodeGuid2, guid2);
            Assert.AreEqual(value, readValue);

            reader.EndForEachIndex();
        }
        finally
        {
            stream.Dispose();
        }
    }
Ejemplo n.º 3
0
        private void toggleStreamDisplay_Click(object sender, EventArgs e, Graph graph, GraphStream stream)
        {
            // toggie the display setting
            stream.display = !stream.display;

            // update the menu item
            MenuItem menuItem = (MenuItem)sender;

            menuItem.Checked = stream.display;

            // clear the stream it's graph points (if it had any)
            stream.series.Points.Clear();
        }
 public Writer(ref GraphStream graphStream)
 {
     m_Writer = graphStream.NativeStream.AsWriter();
 }
Ejemplo n.º 5
0
 public void FlushRecordingStream(GraphStream recordingStream, JobHandle inputDeps)
 {
     recordingStream.InputDeps = inputDeps;
     m_GraphStreams.Add(recordingStream);
 }