The entry counters
The counters of a thread: a process counts the events of the processor for its own code. The design: Architecture: The counters of a thread.
What it is for. It is the proof of the thread counters, and the smallest process that uses them. It counts a loop of known length, and it counts the same reads of memory in two orders, so that a reader sees what a data layout costs in cache misses, and not only in time.
The cases, each with one line of the log:
- 1. A copy of the machine handle with no right: Start_Counters gives No_Right. The right Counters is a grant.
- 2. Read_Counters before a start gives Bad_State: the thread does not count. On a machine with no counters that the kernel uses, the command gives Bad_Operation with the error kind Unsupported: the process says so and ends there.
- 3. A loop of LOOP_TURNS turns, each with a store that the compiler keeps: the instructions retired are at least LOOP_INSTRUCTIONS_LEAST. The four counts are a measure on the line, never a condition.
- 4. A second read later gives no count below the first: the thread goes on counting.
- 5. The same reads of 8 bytes in a region of REGION_PAGES pages, in order, then with a stride of one page: the counts of each order, as a measure.
- 6. Stop_Counters with no handle gives Ok: a stop needs no right. Then Read_Counters gives Bad_State.
Start: start("counters") in the console. The root service gives it the start grant Counters: the machine handle with the right Counters only.
What a reader sees: no window. The log has one line for each case, then "counters: ok". A fault gives "counters: failed: " and what came.
The design: The counters of a thread in the repository.
counters module with an entry
- Hash
66b8cae037e3c691b22c80658128e3dad9b852ff64384e01928b2f62b4780fbc- Size
45056 bytes- Exports
0- Imports
0- Imported by
0- License
- MIT
The counters of a thread: a process counts the events of the processor for its own code
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/counters |
| Boot image | yes: in the boot image, 45056 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
entry() |
entry
entry()
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/counters/main.odin:139
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 | It counts the events of the processor for its own loop . See: Architecture: The counters of a thread | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| The process itself and the region of the reads: 180 pages, as the other small processes that hold no window, and the pages of the region. The tool reads a literal only, so the assert ties it to the region. |
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).
