Solaris-Lgrp

 view release on metacpan or  search on metacpan

Lgrp.xs  view on Meta::CPAN

  POSTCALL:
	RETURN_UNDEF_IF_FAIL;

int
lgrp_fini(cookie)
	lgrp_cookie_t cookie;
  POSTCALL:
	RETURN_UNDEF_IF_FAIL;
	XSRETURN_YES;

lgrp_id_t
lgrp_home(idtype, id)
	idtype_t idtype;
	id_t id;
  POSTCALL:
	RETURN_UNDEF_IF_FAIL;

int
lgrp_latency(lgrp_id_t from,lgrp_id_t to)
  POSTCALL:
	RETURN_UNDEF_IF_FAIL;

lgrp_mem_size_t
lgrp_mem_size(cookie, lgrp, type, content)
	lgrp_cookie_t	cookie
	lgrp_id_t	lgrp
	int		type
	lgrp_content_t	content
  POSTCALL:
	RETURN_UNDEF_IF_FAIL;

int
lgrp_nlgrps(cookie)
	lgrp_cookie_t cookie;
  POSTCALL:
	RETURN_UNDEF_IF_FAIL;

lgrp_id_t
lgrp_root(cookie)
	lgrp_cookie_t cookie
  POSTCALL:
	RETURN_UNDEF_IF_FAIL;

int
lgrp_version(int version = LGRP_VER_NONE)

 #
 # lgrp_latency_cookie calls our internal wrapper  _lgrp_latency_cookie() which
 # works for both old and new versions of liblgrp.
 # 
int
lgrp_latency_cookie(lgrp_cookie_t cookie, lgrp_id_t from, lgrp_id_t to, int between = 0)
  CODE:
	RETVAL = _lgrp_latency_cookie(cookie, from, to, between);
  POSTCALL:
	RETURN_UNDEF_IF_FAIL;
  OUTPUT:
	RETVAL

 #
 # Functions below convert C arrays into Perl lists. They use XS PPCODE
 # directive to avoid implicit RETVAL assignments and manipulate perl
 # stack directly.
 #
 # When called in scalar context functions return the number of elements
 # in the list or undef on failure.
 #
 # The PUSHARRAY() macro defined above pushes all values from the C array to
 # the perl stack.
 #

 #
 # @children = lgrp_children($cookie, $parent).
 #
void
lgrp_children(cookie, lgrp)
	lgrp_cookie_t cookie;
	lgrp_id_t lgrp;
  PREINIT:
	lgrp_id_t *lgrps;
	int	count;
  PPCODE:
	errno = 0;
	if ((count = lgrp_children(cookie, lgrp, NULL, 0)) < 0)
		LGRP_BADVAL();

	if (GIMME_V == G_SCALAR)
		XSRETURN_IV(count);

	if (count > 0) {
		if (New(0, lgrps, count, lgrp_id_t) == NULL) {
			errno = ENOMEM;
			LGRP_BADVAL();
		} else {
			count = lgrp_children(cookie, lgrp, lgrps, count);
			PUSHARRAY(lgrps, count);
			Safefree(lgrps);
		}
	}

 #
 # @parents = lgrp_parents($cookie, $lgrp).
 #
void
lgrp_parents(cookie, lgrp)
	lgrp_cookie_t cookie;
	lgrp_id_t lgrp;
  PREINIT:
	lgrp_id_t *lgrps;
	int count;
  PPCODE:
	errno = 0;
	if ((count = lgrp_parents(cookie, lgrp, NULL, 0)) < 0)
		LGRP_BADVAL();

	if (GIMME_V == G_SCALAR)
		XSRETURN_IV(count);

	if (count > 0) {
		if (New(0, lgrps, count, lgrp_id_t) == NULL) {
			errno = ENOMEM;
			LGRP_BADVAL();
		} else {
			count = lgrp_parents(cookie, lgrp, lgrps, count);
			PUSHARRAY(lgrps, count);
			Safefree(lgrps);
		}
	}

 #
 # @parents = lgrp_cpus($cookie, $lgrp, $content).
 # Content should be LGRP_CONTENT_HIERARCHY or LGRP_CONTENT_ALL or
 # 	LGRP_CONTENT_DIRECT
void
lgrp_cpus(cookie, lgrp, content)
	lgrp_cookie_t cookie;
	lgrp_id_t lgrp;
	lgrp_content_t content;
  PREINIT:
	int ncpus;
	processorid_t *cpus;
  PPCODE:
	errno = 0;
	if ((ncpus = lgrp_cpus(cookie, lgrp, NULL, 0, content)) < 0)
		LGRP_BADVAL();

	if (GIMME_V == G_SCALAR)
		XSRETURN_IV(ncpus);

	if (ncpus > 0) {
		if (New(0, cpus, ncpus, processorid_t) == NULL) {
			errno = ENOMEM;
			LGRP_BADVAL();
		} else {
			ncpus = lgrp_cpus(cookie, lgrp, cpus, ncpus, content);
			PUSHARRAY(cpus, ncpus);
			Safefree(cpus);
		}
	}

void
lgrp_resources(cookie, lgrp, type)
	lgrp_cookie_t cookie;
	lgrp_id_t lgrp;
	int type;
  PPCODE:
	LGRP_RESOURCES(cookie, lgrp, type);



( run in 0.677 second using v1.01-cache-2.11-cpan-5511b514fd6 )