← All procedures

algebra.netemPacketTime

This function gives the time that netem gives a packet of `length` bytes at its rate, in nanoseconds (`packet_time_ns`, lines 357-370). It rounds down. A packet of 1,514 bytes at 10 Mbit/s (1,250,000 bytes per second) takes 1,211,200 ns.

CLI
Package
@procedures/algebra · README
Path
["algebra","netemPacketTime"]
CLI
mark algebra netemPacketTime --length <number> --rate <object>
As data
{"$proc":["algebra","netemPacketTime"],"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","netemPacketTime"], { length: 1, rate: {} });
console.log(JSON.stringify(result));

From the command line

$ mark algebra netemPacketTime --length <number> --rate <object>

As data, in a program

{
  "$proc": ["algebra", "netemPacketTime"],
  "input": { "length": 1, "rate": {} }
}

Input

FieldTypeRequiredDefaultDescription
lengthnumberyes
rateobjectyes

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "length": {
        "type": "number"
      },
      "rate": {
        "type": "object",
        "properties": {
          "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": [
          "rate"
        ],
        "additionalProperties": {}
      }
    },
    "required": [
      "length",
      "rate"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}