mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-16 14:33:24 +09:00
[MG_Util, MG_Remote, tools] (P6): the wire counters and the spawn server's stats latch
Gate 8's last two numbers (SEG_STAGE bytes/frame, records/frame post- chunking) had no producer at all: the summary line's byte classes are backend-to-driver bytes and maxrec is a max, not a per-frame. Two push- guarded counters answer them at their single choke points - ByteClass:: StageSegmentBytes at PipeWireCodec's StageAllocate (the only allocation behind StageBytes, so every buffer walk, texture slab and CSO archive lands there and emitters cannot double-count) and CallClass::WireRecords on EncodeRecord's committed path (post-chunking an emitter no longer knows how many records its one call produced). A staged-blob histogram rides along. G1 holds: symbols 0/0/0/0, .text byte-identical, pull build carries no MG_Remote symbols. The spawn server never counted anything: PipeStats::Init() is a step of MobileGL::Initialize(), which ServerMain never reaches, so every Enabled() site in that process - including ServerLoop's own ServerWaits/ServerParks publish - stayed false and the server log carried no summary line at all (a zero that means 'another process' printed in the shape of one that means 'never waited' is the milder misreading; the line was simply absent). ServerMain now arms and closes PipeStats at its role boundary - after MG_ConfigLoader::Init (Init latches from the parsed config), after the server-role latch (the log sink's role), and before ::_exit(0). Red-once: 0 server summary lines before, 29 after, SSIM 1.0 unchanged. MOBILEGL_PIPE_STATS_FILE now derives per role through the log sink's exported RoleLogPath rule - run.client.json / run.server.json, the bare name resolves to no file - because both roles reach FormatJson() and ofstream trunc made the second writer replace the first. G1 caught three separate leaks on the way (a string temporary in the monolith body, one resized Shutdown() from unequal #if arms, two rewritten MGLOG_W literals in .rodata); the pull arm is statement-for-statement the original. Device tooling for the paired A/B lands with it: pin_device.sh gains a measured 2f7cbe2e entry (this board clamps the GPU at 1050 MHz - thermal_pwrlevel writes 0 and reads back 1, max_gpuclk is read-only; absolute times are not comparable with the 1100 MHz-era rows), and tools/device_bench/p6/ carries the session collector and renderer beside run_android_retrace_local.py's MOBILEGL_TRACE_PACKAGE override. Unit 2367/2367 (PipeStats 25/25), spawn integration 102/102.
This commit is contained in:
@@ -38,6 +38,10 @@
|
||||
#include <MG_Remote/Protocol/generated/protocol_generated.h>
|
||||
#include <MG_State/GLState/ProgramState/ProgramArtifactsCodec.h>
|
||||
#include <MG_Util/Debug/Log.h>
|
||||
// P6 gate 8's two wire counters. MG_Util is BELOW MG_Remote in the build order and the pull build
|
||||
// has no MG_Remote at all, which is why every counter this file touches is behind
|
||||
// #if MOBILEGL_PIPE_PUSH - the same guard the header's producer readings live under.
|
||||
#include <MG_Util/Metrics/PipeStats.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
@@ -857,6 +861,24 @@ namespace MobileGL::MG_Remote::Wire {
|
||||
static_cast<unsigned long long>(m_stageCapacity));
|
||||
}
|
||||
|
||||
// P6 GATE 8's FIRST NUMBER (CONTRACT-P6.md §9 item 8): the bytes this producer staged. The
|
||||
// blob's OWN bytes are recorded, from here - where the request first becomes an allocation
|
||||
// - because this is the ONE place every writer of SEG_STAGE passes through (StageBytes is
|
||||
// the only caller, and every buffer walk, texture slab, CSO archive and block name reaches
|
||||
// them through it), which is what makes the count complete by construction rather than by
|
||||
// a hand-kept list of callers.
|
||||
//
|
||||
// `size`, NOT `need`: the Align8 slack is the allocator's, not content the producer wrote,
|
||||
// and charging it here would make a workload of 8-byte blobs look like one of 16-byte
|
||||
// blobs. The allocator's wrap skip is excluded for the same reason.
|
||||
//
|
||||
// The sample below the byte add is the same call site for the same reason: the per-blob
|
||||
// distribution is a property of what the PRODUCER handed over, before the arena rounds it.
|
||||
if (MG_Util::PipeStats::Enabled()) {
|
||||
MG_Util::PipeStats::AddBytes(MG_Util::PipeStats::ByteClass::StageSegmentBytes, size);
|
||||
MG_Util::PipeStats::RecordStagedBlobBytes(size);
|
||||
}
|
||||
|
||||
bool reclaimed = false;
|
||||
bool waited = false;
|
||||
for (;;) {
|
||||
@@ -1152,6 +1174,20 @@ namespace MobileGL::MG_Remote::Wire {
|
||||
// the measured answer on the reduced path is a different row entirely.
|
||||
m_maxRecordOp = op;
|
||||
}
|
||||
// P6 GATE 8's SECOND NUMBER (CONTRACT-P6.md §9 item 8), and it is counted HERE rather than
|
||||
// at any emitter for the reason the CallClass comment gives: after chunking, the emitter
|
||||
// no longer knows how many records its one call produced. By this point the record is
|
||||
// COMMITTED - Reserve succeeded, the body is written and the blob slots have been checked
|
||||
// honest - so this is exactly "records/frame post-chunking", not "emitter calls/frame".
|
||||
//
|
||||
// A kRecPad FILLER CANNOT REACH HERE: Reserve returns the filler's wake-up as a refusal
|
||||
// (kInvalidSeq) and the caller retries, so no pad is ever counted, which is what keeps
|
||||
// this number comparable with the seq space R-3 defines. A REFUSED emission is not counted
|
||||
// either - the early return above is what makes one record cost exactly one.
|
||||
if (MG_Util::PipeStats::Enabled()) {
|
||||
MG_Util::PipeStats::AddCalls(MG_Util::PipeStats::CallClass::WireRecords, 1);
|
||||
}
|
||||
|
||||
++m_emitSeq;
|
||||
// The stage mark: where SEG_STAGE stood once everything this record names had been
|
||||
// staged. ReclaimStagedBytes releases up to the newest mark the server has retired.
|
||||
|
||||
Reference in New Issue
Block a user