Memory and Thread Placement Optimization Developer's Guide
Previous Next

Locality Group Characteristics

The following API retrieves information about the characteristics of a given lgroup.

Using lgrp_latency_cookie()

The lgrp_latency(3LGRP) function returns the latency between a CPU in one lgroup to the memory in another lgroup.

#include <sys/lgrp_user.h>
int lgrp_latency_cookie(lgrp_cookie_t cookie, lgrp_id_t from, lgrp_id_t to.
                        lat_between_t between);

The lgrp_latency_cookie() function takes a cookie that represents a snapshot of the lgroup hierarchy. The lgrp_init() function creates this cookie. The lgrp_latency_cookie() function returns a value that represents the latency between a hardware resource in the lgroup given by the value of the from argument and a hardware resource in the lgroup given by the value of the to argument. If both arguments point to the same lgroup, the lgrp_latency_cookie() function returns the latency value within that lgroup.


Note - The latency value returned by the lgrp_latency_cookie() function is defined by the operating system and is platform-specific. This value does not necessarily represent the actual latency between hardware devices. Use this value only for comparison within one domain.


When the value of the between argument is LGRP_LAT_CPU_TO_MEM, the lgrp_latency_cookie() function measures the latency from a CPU resource to a memory resource.

The lgrp_latency_cookie() function returns EINVAL when the lgroup ID is not valid. When the lgrp_latency_cookie() function does not find the specified lgroup ID, the “from” lgroup does not contain any CPUs, or the “to” lgroup does not have any memory, the lgrp_latency_cookie() function returns ESRCH.

Previous Next