NaifyView\Observation\Profiler クラス

Profiler — NaifyView2 の軽量観測 recorder

render / compile / runtime の checkpoint を request-local に近い形で集める。 off 時は軽く、debug 時だけ詳細 trace を持つ方針にする。

使用例

$profiler = Profiler::global();
$profiler->checkpointNaifyView('render:start');

プロパティ

名前型説明
private static $global ?Profiler
private static $globalObservationEnabled bool
private static $globalLevel string
private $enabled bool 記録有効フラグ
private $checkpoints array チェックポイント記録
private $badges array カスタムバッジ
private $messages array 詳細上部のメッセージ行
private $nodes array section / checkpoint を表す内部ツリーノード
private $sectionStack array beginSection()/endSection() 用の section スタック
private $nextNodeId int ノード採番用カウンタ
private $name string

メソッド

メソッド説明
public __construct(string $name = default): void インスタンスを初期化する
public static global(): Profiler request 内で共有する NaifyView profiler を返す
public static clearProcessCaches(): void process 単位で持っている profiler recording state をクリアする
public setObservationEnabled(bool $enabled): static `setObservationEnabled()` の値を設定する
public isObservationEnabled(): bool `isObservationEnabled()` かを返す
public setProfilerLevel(string $level): static `setProfilerLevel()` の値を設定する
public getProfilerLevel(): string `getProfilerLevel()` の値を返す
public isEnabledForLevel(string $level): bool `isEnabledForLevel()` かを返す
public static normalizeLevel(mixed $level): string `normalizeLevel()` を実行する
public static setLevel(mixed $levelInput, bool $hostProfilerEnabled = true): void `setLevel()` の値を設定する
public enable(?callable $renderer): static `enable()` を実行する
public disableRenderer(): static `disableRenderer()` を実行する
public checkpoint(string $label = , int $depth = 1): void `checkpoint()` を実行する
public checkpointNaifyView(string $label): void `checkpointNaifyView()` を実行する
public beginSection(string $label = , int $depth = 1): void `beginSection()` を実行する
public beginNaifyViewSection(string $label): void `beginNaifyViewSection()` を実行する
public endSection(): void `endSection()` を実行する
public getName(): string `getName()` の値を返す
public getCheckpoints(): array `getCheckpoints()` の値を返す
public isEnabled(): bool `isEnabled()` かを返す
public addBadge(string $label, string $value, string $style = on, string $description = ): static `addBadge()` を追加する
public getBadges(): array `getBadges()` の値を返す
public addMessage(string $level, string $message): static `addMessage()` を追加する
public addInfo(string $message): static `addInfo()` を追加する
public addWarning(string $message): static `addWarning()` を追加する
public addError(string $message): static `addError()` を追加する
public getMessages(): array `getMessages()` の値を返す
public getSectionTree(): array `getSectionTree()` の値を返す
private static callerLabel(int $depth): string `callerLabel()` を実行する
private initializeTree(): void `initializeTree()` を実行する
private currentSectionId(): int `currentSectionId()` を実行する
private closeActiveSections(): void 観測を無効化するときに、その時点までの区間を閉じる。
private isRecording(): bool 明示的に有効化した個別profilerと、観測設定に従うglobalを区別する。
private resetTree(): void `resetTree()` を実行する
private static levelRank(string $level): int `levelRank()` を実行する
private static naifyViewObservationLabel(string $label): string `naifyViewObservationLabel()` を実行する
private buildTreeNode(int $id, float $rootStart, float $snapshotTime, int $snapshotMemory): array `buildTreeNode()` を実行する