view release on metacpan or search on metacpan
void
getloadavg()
PREINIT:
double loadavg[3];
int nelem;
PPCODE:
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(__linux__) || defined(__sun) || defined(__DragonFly__)
nelem = getloadavg(loadavg, 3);
#else
nelem = -1;
#endif
view all matches for this distribution
view release on metacpan or search on metacpan
void
usually_short()
PREINIT:
SV * out;
char local_name[NS_MAXDNAME];
PPCODE:
if (gethostname(local_name,NS_MAXDNAME) != 0) {
ST(0) = &PL_sv_undef;
}
else {
out = sv_2mortal(newSVpv(local_name,0));
SV * out;
union {
struct in_addr * inadr;
char * addr;
} naddr;
PPCODE:
naddr.addr = (SvPV(netaddr, len));
out = sv_2mortal(newSVpv(inet_ntoa(*naddr.inadr),0));
ST(0) = out;
XSRETURN(1);
union {
struct in_addr * inadr;
char * addr;
} naddr;
struct in_addr myaddr;
PPCODE:
dq = (unsigned char *)(SvPV(dotquad, len));
inet_aton((char *)dq,&myaddr);
out = sv_2mortal(newSVpv((char *)&myaddr.s_addr,4));
ST(0) = out;
XSRETURN(1);
view all matches for this distribution
view release on metacpan or search on metacpan
#else
void
hwloc_get_api_version()
PROTOTYPE:
PPCODE:
XSRETURN_UNDEF;
#endif
# -------------------------------------------------------------------
hwloc_topology_check(topo)
hwloc_topology_t topo
PROTOTYPE: $
ALIAS:
Sys::Hwloc::Topology::check = 1
PPCODE:
PERL_UNUSED_VAR(ix);
hwloc_topology_check(topo);
void
hwloc_topology_destroy(topo)
hwloc_topology_t topo
PROTOTYPE: $
ALIAS:
Sys::Hwloc::Topology::destroy = 1
PPCODE:
PERL_UNUSED_VAR(ix);
if(topo) {
hwloc_topology_destroy(topo);
sv_setref_pv(ST(0), "Sys::Hwloc::Topology", (void *)NULL);
}
hwloc_topology_t topo
const char *path
PROTOTYPE: $$
ALIAS:
Sys::Hwloc::Topology::export_xml = 1
PPCODE:
PERL_UNUSED_VAR(ix);
hwloc_topology_export_xml(topo,path);
#endif
Sys::Hwloc::Topology::get_closest_objs = 1
PREINIT:
int rc;
int i;
hwloc_obj_t *objs = NULL;
PPCODE:
PERL_UNUSED_VAR(ix);
if((objs = (hwloc_obj_t *)malloc(1024 * sizeof(hwloc_obj_t *))) == NULL)
croak("Failed to allocate memory");
rc = hwloc_get_closest_objs(topo,obj,objs,1024);
if(rc < 0)
children(o)
hwloc_obj_t o
PROTOTYPE: $
PREINIT:
int i;
PPCODE:
EXTEND(SP, o->arity);
for(i = 0; i < o->arity; i++)
PUSHs(sv_2mortal(hwlocObj2SV(o->children[i])));
XSRETURN(o->arity);
void
copy(set,dst)
hwloc_cpuset_t set
hwloc_cpuset_t dst
PROTOTYPE: $$
PPCODE:
hwloc_cpuset_copy(dst,set);
#if HWLOC_XSAPI_VERSION
void
Sys::Hwloc::Cpuset::andnot = 1
Sys::Hwloc::Cpuset::or = 2
Sys::Hwloc::Cpuset::xor = 3
PREINIT:
hwloc_cpuset_t res = NULL;
PPCODE:
if((res = hwloc_cpuset_alloc()) == NULL)
croak("Failed to create temporary cpuset in Sys::Hwloc::Cpuset->and alias %d", (int)ix);
if(ix == 0)
hwloc_cpuset_and(res,set,seta);
else if(ix == 1)
not(set)
hwloc_cpuset_t set
PROTOTYPE: $
PREINIT:
hwloc_cpuset_t res = NULL;
PPCODE:
if((res = hwloc_cpuset_alloc()) == NULL)
croak("Failed to create temporary cpuset in Sys::Hwloc::Cpuset->not");
hwloc_cpuset_not(res,set);
hwloc_cpuset_free(set);
sv_setref_pv(ST(0), "Sys::Hwloc::Cpuset", (void *)res);
hwloc_cpuset_t seta
PROTOTYPE: $$
ALIAS:
Sys::Hwloc::Cpuset::or = 2
Sys::Hwloc::Cpuset::xor = 3
PPCODE:
if(ix == 0)
hwloc_cpuset_andset(set,seta);
else if(ix == 2)
hwloc_cpuset_orset(set,seta);
else if(ix == 3)
void
copy(map,dst)
hwloc_bitmap_t map
hwloc_bitmap_t dst
PROTOTYPE: $$
PPCODE:
hwloc_bitmap_copy(dst,map);
void
and(map,mapa)
Sys::Hwloc::Bitmap::andnot = 1
Sys::Hwloc::Bitmap::or = 2
Sys::Hwloc::Bitmap::xor = 3
PREINIT:
hwloc_bitmap_t res = NULL;
PPCODE:
if((res = hwloc_bitmap_alloc()) == NULL)
croak("Failed to create temporary bitmap in Sys::Hwloc::Bitmap->and alias %d", (int)ix);
if(ix == 0)
hwloc_bitmap_and(res,map,mapa);
else if(ix == 1)
not(map)
hwloc_bitmap_t map
PROTOTYPE: $
PREINIT:
hwloc_bitmap_t res = NULL;
PPCODE:
if((res = hwloc_bitmap_alloc()) == NULL)
croak("Failed to create temporary bitmap in Sys::Hwloc::Bitmap->not");
hwloc_bitmap_not(res,map);
hwloc_bitmap_free(map);
sv_setref_pv(ST(0), "Sys::Hwloc::Bitmap", (void *)res);
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPES: ENABLE
void
ibam::new(do_second_correction=TRUE)
int do_second_correction
PPCODE:
ST(0) = new_ibam_object(new ibam(), CLASS);
HV* hv = (HV*)SvRV(ST(0));
hv_store(hv, "do_second_correction", 20, newSViv(do_second_correction), 0);
sv_2mortal(ST(0));
XSRETURN(1);
view all matches for this distribution
view release on metacpan or search on metacpan
TCHAR wProcessorModel [10];
TCHAR wProcessorStepping [10];
TCHAR wProcessorArchitecture2 [64];
unsigned int wProcessBitness;
unsigned int wProcessorBitness;
PPCODE:
/*
See:
- http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx
- http://blogs.msdn.com/junfeng/archive/2005/07/01/434574.aspx
*/
unsigned ecx = 0;
unsigned CpuFeatures = 0;
unsigned Flags;
unsigned KFBits;
unsigned FeatureFlags;
PPCODE:
/*
Resources:
- http://msdn.microsoft.com/en-us/library/hskdteyh(VS.80).aspx
- http://stackoverflow.com/questions/794632/programmatically-get-the-cache-line-size
- http://en.wikipedia.org/wiki/CPUID
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPES: ENABLE
void
getllent(self)
SV *self
PPCODE:
struct lastlog *llent;
SV *ll_ref;
static IV count = 0;
void
getlluid(self, uid)
SV *self
IV uid
PPCODE:
struct lastlog *llent;
SV *ll_ref;
if(!SvROK(self))
croak("Must be called as an object method");
void
getllnam(self,logname)
SV *self
char *logname
PPCODE:
struct passwd *pwd;
struct lastlog *llent;
SV *ll_ref;
if(!SvROK(self))
XSRETURN_EMPTY;
}
void lastlog_path(self)
SV *self
PPCODE:
if(!SvROK(self))
croak("Must be called as an object method");
EXTEND(SP,1);
PUSHs(sv_2mortal(newSVpv(lastlog_path(),0)));
void
setllent(self)
SV *self
PPCODE:
if(!SvROK(self))
croak("Must be called as an object method");
setllent();
view all matches for this distribution
view release on metacpan or search on metacpan
getload()
PROTOTYPE:
PREINIT:
double load[3];
int i;
PPCODE:
i = getloadavg(load, 3);
if(i == -1)
XSRETURN_EMPTY;
else {
XPUSHs(sv_2mortal(newSVnv(load[0])));
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPE:
PREINIT:
double loadavg[2];
int retval;
int i;
PPCODE:
retval = getloadavg(loadavg, 3);
EXTEND(SP, 3);
for (i=0; i<3; i++) {
if (i < retval) {
PUSHs(sv_2mortal(newSVnv(loadavg[i])));
view all matches for this distribution
view release on metacpan or search on metacpan
arch/aix.xs view on Meta::CPAN
#include <libperfstat.h>
void
availkeys()
PREINIT:
PPCODE:
XPUSHs(sv_2mortal(newSVpv(_totalmem, strlen(_totalmem))));
XPUSHs(sv_2mortal(newSVpv(_freemem, strlen(_freemem))));
XPUSHs(sv_2mortal(newSVpv(_totalswap, strlen(_totalswap))));
XPUSHs(sv_2mortal(newSVpv(_freeswap, strlen(_freeswap))));
view all matches for this distribution
view release on metacpan or search on metacpan
Proctitle.xs view on Meta::CPAN
RETVAL
void
setproctitle(...)
PROTOTYPE: @
PPCODE:
if( items > 0 ) {
char *title, *buf, *cur;
STRLEN len;
int i, max;
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* NV nv; Uncomment this if you need to return NVs */
const char *pv;
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv, &pv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution