The entry plasma
The source src/modules/demonstrations/plasma built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
A demonstration: an animation that the processor computes for each frame.
What it is for. It is a load that never ends and never waits for an input: one thread computes each pixel of a picture of 320 by 200, about 30 times in one second, with integers only. It shows the share of the processor of a busy process in monitor, and the cost of a full picture for the compositor.
Start: start("plasma") in the console, or the bar of the desktop. The log has "plasma: ok" after the first picture. Its row of start_grant_sets has no grant: a window is all that it needs.
How it computes: a table of the sine in 256 steps of a turn, from trigonometry.sine once at the start, and a palette of 256 colors from three sines a third of a turn apart. Each pixel is the sum of four sines of its place and of the frame number, in integers.
plasma module with an entry
- Hash
e9483bc119e6057c1f870327c88ce3e9ce713e014bcd75328595216632ec2450- Size
136571 bytes- Exports
0- Imports
1- Imported by
0- License
- MIT
A demonstration: an animation that the processor computes for each frame
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/plasma |
| Boot image | yes: in the boot image, 136571 bytes in this build |
| Build settings |
|
| Imports | |
| Imported by | none |
Neighbours
What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.
Exports
| Export | What it does |
|---|---|
entry() | The entry of plasma: it builds the sine table and the palette, then computes and shows one picture every 33 ms for ever |
entry
entry()
The entry of plasma: it builds the sine table and the palette, then computes and shows one picture every 33 ms for ever.
With no window it stops with Failed. The time of each picture is fixed from the first one: after a slow picture, the next pictures follow with no sleep until the process is on time again.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/plasma/main.odin:53
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | none | A load that never ends and never waits for an input. |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| The least budget of 2048 pages, in which it ran before it stated its window, less that window at the scale 1 (125 pages): its module, its stack and its tables. The tool counts the window at the largest scale . See: Module contract: The budget that a module asks for |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
start_grant_sets global variable of the package root
start_grant_sets := [?]Start_Grant_Set_Row {...}
The start grant set of each module of the boot image, with the reason of each.
sine procedure of the package trigonometry
sine :: proc "contextless" (angle_turns: f64) -> f64
sine gives the sine of an angle in turns.
