Added some UE isnights traces
This commit is contained in:
parent
e1938e13bd
commit
86efe6f581
|
@ -51,6 +51,7 @@ namespace rpc {
|
|||
}
|
||||
|
||||
void SyncRunFor(time_duration duration) {
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
_sync_io_context.reset();
|
||||
_sync_io_context.run_for(duration.to_chrono());
|
||||
}
|
||||
|
|
|
@ -111,6 +111,7 @@ void FCarlaEngine::NotifyEndEpisode()
|
|||
|
||||
void FCarlaEngine::OnPreTick(UWorld *, ELevelTick TickType, float DeltaSeconds)
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
if (TickType == ELevelTick::LEVELTICK_All)
|
||||
{
|
||||
// update frame counter
|
||||
|
@ -132,6 +133,7 @@ void FCarlaEngine::OnPreTick(UWorld *, ELevelTick TickType, float DeltaSeconds)
|
|||
|
||||
void FCarlaEngine::OnPostTick(UWorld *World, ELevelTick TickType, float DeltaSeconds)
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
// tick the recorder/replayer system
|
||||
if (GetCurrentEpisode())
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@ static void WritePixelsToBuffer_Vulkan(
|
|||
uint32 Offset,
|
||||
FRHICommandListImmediate &InRHICmdList)
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
check(IsInRenderingThread());
|
||||
auto RenderResource =
|
||||
static_cast<const FTextureRenderTarget2DResource *>(RenderTarget.Resource);
|
||||
|
@ -58,12 +59,18 @@ static void WritePixelsToBuffer_Vulkan(
|
|||
FIntPoint Rect = RenderResource->GetSizeXY();
|
||||
|
||||
// NS: Extra copy here, don't know how to avoid it.
|
||||
InRHICmdList.ReadSurfaceData(
|
||||
Texture,
|
||||
FIntRect(0, 0, Rect.X, Rect.Y),
|
||||
gPixels,
|
||||
FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX));
|
||||
Buffer.copy_from(Offset, gPixels);
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT("Read Surface");
|
||||
InRHICmdList.ReadSurfaceData(
|
||||
Texture,
|
||||
FIntRect(0, 0, Rect.X, Rect.Y),
|
||||
gPixels,
|
||||
FReadSurfaceDataFlags(RCM_UNorm, CubeFace_MAX));
|
||||
}
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT("Buffer Copy");
|
||||
Buffer.copy_from(Offset, gPixels);
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
@ -130,6 +137,7 @@ void FPixelReader::WritePixelsToBuffer(
|
|||
FRHICommandListImmediate &InRHICmdList
|
||||
)
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
check(IsInRenderingThread());
|
||||
|
||||
if (IsVulkanPlatform(GMaxRHIShaderPlatform) || IsD3DPlatform(GMaxRHIShaderPlatform, false))
|
||||
|
|
|
@ -101,6 +101,8 @@ void FPixelReader::SendPixelsInRenderThread(TSensor &Sensor)
|
|||
(
|
||||
[&Sensor, Stream=Sensor.GetDataStream(Sensor)](auto &InRHICmdList) mutable
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT("FWritePixels_SendPixelsInRenderThread");
|
||||
|
||||
/// @todo Can we make sure the sensor is not going to be destroyed?
|
||||
if (!Sensor.IsPendingKill())
|
||||
{
|
||||
|
@ -113,12 +115,16 @@ void FPixelReader::SendPixelsInRenderThread(TSensor &Sensor)
|
|||
if(Buffer.data())
|
||||
{
|
||||
SCOPE_CYCLE_COUNTER(STAT_CarlaSensorStreamSend);
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT("Stream Send");
|
||||
Stream.Send(Sensor, std::move(Buffer));
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Blocks until the render thread has finished all it's tasks
|
||||
Sensor.WaitForRenderThreadToFinsih();
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT("FPixelReader::WaitForRenderThreadToFinsih");
|
||||
// Blocks until the render thread has finished all it's tasks
|
||||
Sensor.WaitForRenderThreadToFinsih();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ static carla::Buffer FWorldObserver_Serialize(
|
|||
bool MapChange,
|
||||
bool PendingLightUpdates)
|
||||
{
|
||||
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
using Serializer = carla::sensor::s11n::EpisodeStateSerializer;
|
||||
using SimulationState = carla::sensor::s11n::EpisodeStateSerializer::SimulationState;
|
||||
using ActorDynamicState = carla::sensor::data::ActorDynamicState;
|
||||
|
@ -243,6 +243,7 @@ void FWorldObserver::BroadcastTick(
|
|||
bool MapChange,
|
||||
bool PendingLightUpdates)
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
auto AsyncStream = Stream.MakeAsyncDataStream(*this, Episode.GetElapsedGameTime());
|
||||
|
||||
auto buffer = FWorldObserver_Serialize(
|
||||
|
|
|
@ -1664,14 +1664,31 @@ void FCarlaServer::AsyncRun(uint32 NumberOfWorkerThreads)
|
|||
{
|
||||
check(Pimpl != nullptr);
|
||||
/// @todo Define better the number of threads each server gets.
|
||||
auto RPCThreads = NumberOfWorkerThreads / 2u;
|
||||
auto StreamingThreads = NumberOfWorkerThreads - RPCThreads;
|
||||
Pimpl->Server.AsyncRun(std::max(2u, RPCThreads));
|
||||
Pimpl->StreamingServer.AsyncRun(std::max(2u, StreamingThreads));
|
||||
int32_t RPCThreads = std::max(2u, NumberOfWorkerThreads / 2u);
|
||||
int32_t StreamingThreads = std::max(2u, NumberOfWorkerThreads - RPCThreads);
|
||||
|
||||
UE_LOG(LogCarla, Error, TEXT("FCommandLine %s"), FCommandLine::Get());
|
||||
|
||||
if(!FParse::Value(FCommandLine::Get(), TEXT("-RPCThreads="), RPCThreads))
|
||||
{
|
||||
RPCThreads = std::max(2u, NumberOfWorkerThreads / 2u);
|
||||
}
|
||||
if(!FParse::Value(FCommandLine::Get(), TEXT("-StreamingThreads="), StreamingThreads))
|
||||
{
|
||||
StreamingThreads = std::max(2u, NumberOfWorkerThreads - RPCThreads);
|
||||
}
|
||||
|
||||
UE_LOG(LogCarla, Error, TEXT("FCarlaServer AsyncRun %d, RPCThreads %d, StreamingThreads %d"),
|
||||
NumberOfWorkerThreads, RPCThreads, StreamingThreads);
|
||||
|
||||
Pimpl->Server.AsyncRun(RPCThreads);
|
||||
Pimpl->StreamingServer.AsyncRun(StreamingThreads);
|
||||
|
||||
}
|
||||
|
||||
void FCarlaServer::RunSome(uint32 Milliseconds)
|
||||
{
|
||||
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(__FUNCTION__);
|
||||
Pimpl->Server.SyncRunFor(carla::time_duration::milliseconds(Milliseconds));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue