algebra.netemSchedule
This function gives the outcome of each packet in a netem queue with a rate. A packet that the queue takes leaves at `max(last, at + latency) + time`. `last` is the time to send of the packet before it, and `time` is the time of `netemPacketTime`. The queue holds each packet until it leaves, thus a delay of 100 ms at 1,000 packets per second fills a limit of 100.
CLI- Package
- @procedures/algebra · README
- Path
["algebra","netemSchedule"]- CLI
mark algebra netemSchedule --packets <object[]> --queue <object>- As data
{"$proc":["algebra","netemSchedule"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/algebra/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["algebra","netemSchedule"], { packets: [], queue: {} });
console.log(JSON.stringify(result));From the command line
$ mark algebra netemSchedule --packets <object[]> --queue <object>
As data, in a program
{
"$proc": ["algebra", "netemSchedule"],
"input": { "packets": [], "queue": {} }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
packets | object[] | yes | ||
queue | object | yes |
Output
The schema does not list fields (object | object[]).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"packets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"at": {
"type": "number",
"description": "This value is the time of the arrival, in nanoseconds. The arrivals of a schedule do not go back in time."
},
"length": {
"type": "number",
"description": "This value is the qdisc length of the packet, in bytes."
}
},
"required": [
"at",
"length"
],
"additionalProperties": {}
}
},
"queue": {
"type": "object",
"properties": {
"latency": {
"type": "number",
"description": "This value is the delay of each packet, in nanoseconds, with no jitter."
},
"limit": {
"type": "number",
"description": "This value is the most packets that the queue of netem holds."
},
"rate": {
"type": "number",
"description": "This value is the rate in bytes per second."
},
"packetOverhead": {
"type": "number",
"description": "This value is the overhead that netem adds to each length. It can be negative."
},
"cellSize": {
"type": "number",
"description": "This value is the size of one cell. With 0, netem counts no cells."
},
"cellOverhead": {
"type": "number",
"description": "This value is the overhead of each cell. It can be negative."
}
},
"required": [
"limit",
"rate"
],
"additionalProperties": {}
}
},
"required": [
"packets",
"queue"
],
"additionalProperties": false
},
"output": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "dropped"
},
"why": {
"type": "string",
"enum": [
"limit",
"size"
],
"description": "A `limit` drop is a full queue. A `size` drop is a packet longer than the largest size of tbf."
},
"ahead": {
"type": "number"
},
"bytes": {
"type": "number"
}
},
"required": [
"kind",
"why",
"ahead",
"bytes"
],
"additionalProperties": {}
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "sent"
},
"at": {
"type": "number",
"description": "This value is the time that the packet leaves the qdisc, in nanoseconds."
},
"ahead": {
"type": "number",
"description": "This value is the packets in the queue at the arrival of the packet."
},
"bytes": {
"type": "number",
"description": "This value is the bytes in the queue at the arrival of the packet."
}
},
"required": [
"kind",
"at",
"ahead",
"bytes"
],
"additionalProperties": {}
}
]
}
}
}