{"id":"runtime--Compute.RuntimeCounter","name":"Compute.RuntimeCounter","owner":"yeho","package":"runtime.Compute","kind":"builtin","signature":"Compute.RuntimeCounter(int value) -> int","description":"Read a process-lifetime instrumentation counter. Counter 1 counts compute dispatch encodes; the counter does not reset when read.","context":"Built into Yeho; no package import is needed. Native services require an admitted host and the correct resource lifecycle.","parameters":[{"name":"value","type":"int","description":"Supply value as int.","rule":"AnyInteger"}],"returns":"int","members":[],"tags":["builtin","compute","gameplay","gpu","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"src/compiler/common/intrinsic_registry.cpp","line":1420,"sha256":"14d29529d2d3c0e2b587f83c7f125b99ada142ed7ae28612701ea6cb9174ac65"},"status":"registered-intrinsic","notes":["The example checks the call shape. Opening windows, recording audio, changing files, network operations, and process operations have real effects when run. Follow the corresponding package lifecycle before using live resources."],"examples":[{"id":"gpu","title":"GPU · [gpu]","description":"Run a GPU pass and read the process-lifetime dispatch-encode counter. Counter 1 counts encodes, not frames or GPU duration.","code":"[gpu]\ncompute DoubleRewards(buffer of int rewards, int multiplier)\n{\n    int index = compute.index\n    if index >= rewards.count { return }\n    rewards[index] = rewards[index] * multiplier\n}\n\nbuffer of int rewards\nrewards.Add(100)\nrewards.Add(80)\nrewards.Add(60)\ncomputeTask job = dispatch DoubleRewards(rewards, 2)\nwait job\nif job.failed { Console.Error(job.error.message) Process.Exit(1) }\nfor index from 0 < rewards.count { Console.Log(Text.From(rewards[index])) }\nConsole.Log(Text.From(Compute.RuntimeCounter(1)))\n","tags":["gpu","compute","gameplay"],"run":"metal","expected":"200\n160\n120\n1","verifyRun":true,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.runtime__compute_runtimecounter\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"executed","sha256":"532ef62d3ec53cfc7230f6960719f547d747d7ff9e1610a1ba537c6a6651d2a4","checked":"2026-09-09","diagnostic":"","observedOutput":"200\n160\n120\n1","checkedBackend":"metal"}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=runtime--Compute.RuntimeCounter","json":"https://demonhunterlabs.com/reference/items/runtime--Compute.RuntimeCounter.json","markdown":"https://demonhunterlabs.com/reference/text/runtime--Compute.RuntimeCounter.md"}
