{"id":"compute.profiling--BuildMemorySample","name":"BuildMemorySample","owner":"yeho","package":"compute.profiling","kind":"function","signature":"external BuildMemorySample(text label, text stage, text device, int bytesBefore, int bytesAfter, int peakBytes, int reusedBytes, text note) returns memorySample","description":"Build memory sample.","context":"Collect and describe compute timing, work, and profiling records.","parameters":[{"name":"label","type":"text","description":"Supply label as text."},{"name":"stage","type":"text","description":"Supply stage as text."},{"name":"device","type":"text","description":"Supply device as text."},{"name":"bytesBefore","type":"int","description":"Supply bytes before as int."},{"name":"bytesAfter","type":"int","description":"Supply bytes after as int."},{"name":"peakBytes","type":"int","description":"Supply peak bytes as int."},{"name":"reusedBytes","type":"int","description":"Supply reused bytes as int."},{"name":"note","type":"text","description":"Supply note as text."}],"returns":"memorySample","members":[],"tags":["compute","compute.profiling","cpu","function","profiling","source-example","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"packages/compute/profiling/profiling.yh","line":740,"sha256":"067dd2a8894dc02cf9197cfff4d83258fae401d7f03ae44b9f38d3c68bed1e7b"},"status":"source-declared","notes":["Package presence and a declaration do not establish support on every host. Host services need their platform and lifecycle setup."],"examples":[{"id":"usage","title":"Use BuildMemorySample","description":"A complete small caller. Values are illustrative; check the returned result and package requirements before connecting live resources.","code":"using compute.profiling\n\n// Collect and describe compute timing, work, and profiling records.\ntext label = \"Player health\"\ntext stage = \"stage\"\ntext device = \"device\"\nint bytesBefore = 4\nint bytesAfter = 4\nint peakBytes = 4\nint reusedBytes = 4\ntext note = \"note\"\nmemorySample result = BuildMemorySample(label, stage, device, bytesBefore, bytesAfter, peakBytes, reusedBytes, note)\nConsole.Log(\"Inspect result in your debugger\")\n","manifest":"manifestVersion = \"2\"\npackage = \"api.example.compute_profiling__buildmemorysample\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n\n[[dependencies]]\npackage = \"compute.profiling\"\nversion = \"0.1.0\"\npath = \"../../../yeho/packages/compute/profiling\"\n\n[[dependencies]]\npackage = \"compute.tensor\"\nversion = \"0.1.0\"\npath = \"../../../yeho/packages/compute/tensor\"\n\n[[dependencies]]\npackage = \"console\"\nversion = \"0.1.0\"\npath = \"../../../yeho/packages/console\"\n\n[[dependencies]]\npackage = \"diagnostics\"\nversion = \"0.1.0\"\npath = \"../../../yeho/packages/diagnostics\"\n","tags":["cpu","source-example"],"verification":"type checked","run":"cpu-oracle","sha256":"6ce8996b92debb6f40aeb8049a3eba0735e03f28d42dcd58fe8258ceeaedca3b","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=compute.profiling--BuildMemorySample","json":"https://demonhunterlabs.com/reference/items/compute.profiling--BuildMemorySample.json","markdown":"https://demonhunterlabs.com/reference/text/compute.profiling--BuildMemorySample.md"}
