Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
 4.2.99
Latency Monitor

Latency Monitor. More...

Typedefs

typedef int(* net_latmon_measure_t) (uint32_t *delta)
 Callback function type for retrieving latency deltas.

Functions

void net_latmon_start (int latmus, net_latmon_measure_t measure_func)
 Start the latency monitor.
int net_latmon_connect (int socket, struct in_addr *ip)
 Wait for a connection from a Latmus client.
int net_latmon_get_socket (struct sockaddr *bind_addr)
 Get a socket for the Latmus service.
bool net_latmon_running (void)
 Check if the latency monitor is running.

Detailed Description

Latency Monitor.

Typedef Documentation

◆ net_latmon_measure_t

typedef int(* net_latmon_measure_t) (uint32_t *delta)

#include <zephyr/net/latmon.h>

Callback function type for retrieving latency deltas.

Parameters
deltaPointer to store the calculated latency delta in cycles.
Returns
0 on success, negative errno code on failure.

Function Documentation

◆ net_latmon_connect()

int net_latmon_connect ( int socket,
struct in_addr * ip )

#include <zephyr/net/latmon.h>

Wait for a connection from a Latmus client.

This function blocks until a Latmus client connects to the specified socket. Once connected, the client's IP address is stored in the provided ip structure.

Parameters
socketA valid socket descriptor for listening.
ipThe client's IP address.
Returns
A valid client socket descriptor connected to latmus on success, negative errno code on failure.

◆ net_latmon_get_socket()

int net_latmon_get_socket ( struct sockaddr * bind_addr)

#include <zephyr/net/latmon.h>

Get a socket for the Latmus service.

This function creates and returns a socket to wait for Latmus connections

Parameters
bind_addrThe address to bind the socket to. If NULL, the socket will be bound to the first available address using the build time configured latmus port.
Returns
A valid socket descriptor on success, negative errno code on failure.

◆ net_latmon_running()

bool net_latmon_running ( void )

#include <zephyr/net/latmon.h>

Check if the latency monitor is running.

This function checks whether the latency monitor is currently active and running.

Returns
True if the latency monitor is running, false if it is waiting for a Latmus connection

◆ net_latmon_start()

void net_latmon_start ( int latmus,
net_latmon_measure_t measure_func )

#include <zephyr/net/latmon.h>

Start the latency monitor.

This function starts the latency monitor, which measures latency using the provided callback function to calculate deltas. Samples are sent to the connected Latmus client.

Parameters
latmusA valid socket descriptor connected to latmus
measure_funcA callback function to execute the delta calculation.