Дополнительные логи для проявления задержки
This commit is contained in:
@@ -17,6 +17,8 @@ class Program
|
||||
// builder.UseJsonSerialisation();
|
||||
builder.Modules.Add(new CborSerializationToolkit());
|
||||
builder.Modules.Add(new BackendIdentityGenerator());
|
||||
// builder.UseNetworkGateway(new IPEndPoint(IPAddress.Loopback, 4567), typeof(NextGenerationInteractionModule),
|
||||
// builder.GetModule<IIdentityGenerator>()!);
|
||||
builder.UseNetworkGateway(new IPEndPoint(IPAddress.Loopback, 4567), typeof(NextGenerationInteractionModule),
|
||||
builder.GetModule<IIdentityGenerator>()!);
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Example.Events.Shared\Example.Events.Shared.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Example.Events.Shared\Example.Events.Shared.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using Example.Events.Shared;
|
||||
using mROA.Cbor;
|
||||
using mROA.Codegen;
|
||||
@@ -56,9 +57,16 @@ class Program
|
||||
}
|
||||
else
|
||||
symb = input.KeyChar.ToString();
|
||||
|
||||
#if TRACE
|
||||
Console.Write(symb);
|
||||
var sw = Stopwatch.StartNew();
|
||||
chat.PostSymbol(symb);
|
||||
sw.Stop();
|
||||
Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
|
||||
#else
|
||||
Console.Write(symb);
|
||||
chat.PostSymbol(symb);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using mROA.Abstract;
|
||||
@@ -67,10 +68,18 @@ namespace mROA.Implementation.Frontend
|
||||
|
||||
try
|
||||
{
|
||||
#if TRACE
|
||||
var sw = new Stopwatch();
|
||||
#endif
|
||||
while (true)
|
||||
{
|
||||
#if TRACE
|
||||
Console.WriteLine("Waiting for request...");
|
||||
if (sw.IsRunning)
|
||||
{
|
||||
sw.Stop();
|
||||
Console.WriteLine($"Request handling took {sw.ElapsedMilliseconds} milliseconds.");
|
||||
}
|
||||
#endif
|
||||
var tokenSource = new CancellationTokenSource();
|
||||
var token = tokenSource.Token;
|
||||
@@ -86,6 +95,7 @@ namespace mROA.Implementation.Frontend
|
||||
Task.WaitAny(defaultRequest, cancelRequest, eventRequest);
|
||||
#if TRACE
|
||||
Console.WriteLine("Request received");
|
||||
sw.Restart();
|
||||
#endif
|
||||
if (cancelRequest.IsCompleted)
|
||||
{
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace mROA.Implementation
|
||||
|
||||
var rawMessage = _serialization.Serialize(message);
|
||||
var header = BitConverter.GetBytes((ushort)rawMessage.Length).AsMemory(0, sizeof(ushort));
|
||||
|
||||
await BaseStream.WriteAsync(header);
|
||||
await BaseStream.WriteAsync(rawMessage);
|
||||
}
|
||||
@@ -89,7 +90,7 @@ namespace mROA.Implementation
|
||||
|
||||
var message = _serialization.Deserialize<NetworkMessage>(localSpan.Span);
|
||||
#if TRACE
|
||||
Console.WriteLine($"Received Message {message.Id} - {message.SchemaId}");
|
||||
Console.WriteLine($"{DateTime.Now.TimeOfDay} Received Message {message.Id} - {message.SchemaId}");
|
||||
TransmissionConfig.TotalTransmittedBytes += len;
|
||||
Console.WriteLine($"Total recieced bytes are {TransmissionConfig.TotalTransmittedBytes}");
|
||||
#endif
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace mROA.Implementation
|
||||
if (_serialization == null)
|
||||
throw new NullReferenceException("Serialization toolkit is not initialized");
|
||||
#if TRACE
|
||||
Console.WriteLine($"Posting message: {id} - {messageType} to {Id}");
|
||||
Console.WriteLine($"{DateTime.Now.TimeOfDay} Posting message: {id} - {messageType} to {Id}");
|
||||
#endif
|
||||
|
||||
var serialized = _serialization.Serialize(payload, payloadType);
|
||||
|
||||
Reference in New Issue
Block a user