Memory and Thread Placement Optimization Developer's Guide
Previous

The Solaris::lgrp Module

This Perl module provides a Perl interface to the lgroup APIs that are in liblgrp. This interface provides a way to traverse the lgroup hierarchy, discover its contents and characteristics, and set a thread's affinity for an lgroup. The module gives access to various constants and functions defined in the lgrp_user.h header file. The module provides the procedural interface and the object interface to the library.

The default behavior of this module does not export anything. You can use the following tags to selectively import the constants and functions that are defined in this module:

:LGRP_CONSTANTS

LGRP_AFF_NONE, LGRP_AFF_STRONG, LGRP_AFF_WEAK, LGRP_CONTENT_DIRECT, LGRP_CONTENT_HIERARCHY, LGRP_MEM_SZ_FREE, LGRP_MEM_SZ_INSTALLED, LGRP_VER_CURRENT, LGRP_VER_NONE, LGRP_VIEW_CALLER, LGRP_VIEW_OS, LGRP_NONE, LGRP_RSRC_CPU, LGRP_RSRC_MEM, LGRP_CONTENT_ALL, LGRP_LAT_CPU_TO_MEM

:PROC_CONSTANTS

P_PID, P_LWPID, P_MYID

:CONSTANTS

:LGRP_CONSTANTS, :PROC_CONSTANTS

:FUNCTIONS

lgrp_affinity_get(), lgrp_affinity_set(), lgrp_children(), lgrp_cookie_stale(), lgrp_cpus(), lgrp_fini(), lgrp_home(), lgrp_init(), lgrp_latency(), lgrp_latency_cookie(), lgrp_mem_size(), lgrp_nlgrps(), lgrp_parents(), lgrp_root(), lgrp_version(), lgrp_view(), lgrp_resources(), lgrp_lgrps(), lgrp_leaves(), lgrp_isleaf(), lgrp_lgrps(), lgrp_leaves().

:ALL()

:CONSTANTS(), :FUNCTIONS()

The Perl module has the following methods:

  • new()

  • cookie()

  • stale()

  • view()

  • root()

  • children()

  • parents()

  • nlgrps()

  • mem_size()

  • cpus()

  • isleaf()

  • resources()

  • version()

  • home()

  • affinity_get()

  • affinity_set()

  • lgrps()

  • leaves()

  • latency()

You can export constants with the :CONSTANTS or :ALL tags. You can use any of the constants in the following list in Perl programs.

  • LGRP_NONE

  • LGRP_VER_CURRENT

  • LGRP_VER_NONE

  • LGRP_VIEW_CALLER

  • LGRP_VIEW_OS

  • LGRP_AFF_NONE

  • LGRP_AFF_STRONG

  • LGRP_AFF_WEAK

  • LGRP_CONTENT_DIRECT

  • LGRP_CONTENT_HIERARCHY

  • LGRP_MEM_SZ_FREE

  • LGRP_MEM_SZ_INSTALLED

  • LGRP_RSRC_CPU

  • LGRP_RSRC_MEM

  • LGRP_CONTENT_ALL

  • LGRP_LAT_CPU_TO_MEM

  • P_PID

  • P_LWPID

  • P_MYID

When an underlying library function fails, the functions in this module return either undef or an empty list. The module can use the following error codes:

EINVAL

The value supplied is not valid.

ENOMEM

There was not enough system memory to complete an operation.

ESRCH

The specified process or thread was not found.

EPERM

The effective user of the calling process does not have the appropriate privileges, and its real or effective user ID does not match the real or effective user ID of one of the threads.

Previous