载入中...
搜索中...
未找到
ProfilerRuntime.cpp
浏览该文件的文档.
2
3#include "profiler/Profiler.h"
4
5#include <utility>
6
7namespace eve::profiler_editing {
8
11 auto captured = profiler.captureFrame();
12 if (!captured.hasValue()) {
13 std::vector<EditorDiagnostic> diagnostics;
14 for (const auto& diagnostic : captured.diagnostics())
15 diagnostics.push_back(eve::editing::ruleDiagnostic(
16 diagnostic.code(), RuleId("editor.profiler.capture"),
17 DiagnosticSeverity::Error, diagnostic.message()));
18 const EditorStatus status = captured.code() == eve::StatusCode::NotFound
19 ? EditorStatus::NotFound
20 : EditorStatus::Failed;
21 return Result<void>::failure(eve::Status(status, std::move(diagnostics)));
22 }
23 auto runtimeFrame = std::move(captured).takeValue();
25 frame.sequence = runtimeFrame.sequence;
26 frame.cpuFrameMs = runtimeFrame.cpuFrameMs;
27 frame.gpuFrameMs = runtimeFrame.gpuFrameMs;
28 frame.gpuTimingAvailable = runtimeFrame.gpuTimingAvailable;
29 frame.zones.reserve(runtimeFrame.zones.size());
30 for (auto& zone : runtimeFrame.zones) {
31 frame.zones.push_back({std::move(zone.module), std::move(zone.name),
32 std::move(zone.thread), zone.selfMs, zone.totalMs, zone.count,
33 zone.depth});
34 }
35 return model.ingest(std::move(frame));
36}
37
38} // namespace eve::profiler_editing
wgpu::PopErrorScopeStatus status
glm::mat4 model
Move-only operation result carrying either a value or Status.
Definition Result.h:155
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Structured status and zero or more diagnostics for an operation.
Definition Status.h:68
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
Script-facing wrapper around the engine-wide profiler core (eve::prof, see common/Profile....
Definition Profiler.h:67
eve::Result< ProfilerFrameSnapshot > captureFrame() const
Copy the latest completed frame for editor and diagnostics consumers.
Definition Profiler.cpp:100
Result< void > collect(const profiler::Profiler &profiler, EditorProfilerModel &model) const
Copy and ingest the latest runtime frame.
Bounded owning profiler history and deterministic presentation queries. @thread Main-thread only....
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build a common diagnostic carrying an open editing rule identity.
StatusCode
Stable outcome category for an operation.
Definition Status.h:27
One owning completed-frame sample retained by the editor.
std::vector< EditorProfilerZone > zones