.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Sys::Info::Device::CPU 3pm" .TH Sys::Info::Device::CPU 3pm "2019-02-22" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Sys::Info::Device::CPU .SH "VERSION" .IX Header "VERSION" version 0.7807 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use Sys::Info; \& use Sys::Info::Constants qw( :device_cpu ); \& my $info = Sys::Info\->new; \& my $cpu = $info\->device( CPU => %options ); .Ve .PP Example: .PP .Vb 4 \& printf "CPU: %s\en", scalar($cpu\->identify) || \*(AqN/A\*(Aq; \& printf "CPU speed is %s MHz\en", $cpu\->speed || \*(AqN/A\*(Aq; \& printf "There are %d CPUs\en" , $cpu\->count || 1; \& printf "CPU load: %s\en" , $cpu\->load || 0; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Collects and returns information about the Central Processing Unit (\s-1CPU\s0) on the host machine. .PP Some platforms can limit the available information under some user accounts and this will affect the accessible amount of data. When this happens, some methods will not return anything usable. .SH "NAME" Sys::Info::Device::CPU \- CPU information. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" Acceps parameters in \f(CW\*(C`key => value\*(C'\fR format. .PP \fIcache\fR .IX Subsection "cache" .PP If has a true value, internal cache will be enabled. Cache timeout can be controlled via \f(CW\*(C`cache_timeout\*(C'\fR parameter. .PP On some platforms, some methods can take a long time to be completed (i.e.: \s-1WMI\s0 access on Windows platform). If cache is enabled, all gathered data will be saved in an internal in-memory cache and, the related method will serve from cache until the cache expires. .PP Cache only has a meaning, if you call the related method continiously (in a loop, under persistent environments like \s-1GUI,\s0 mod_perl, PerlEx, etc.). It will not have any effect if you are calling it only once. .PP \fIcache_timeout\fR .IX Subsection "cache_timeout" .PP Must be used together with \f(CW\*(C`cache\*(C'\fR parameter. If cache is enabled, and this is not set, it will take the default value: \f(CW10\fR. .PP Timeout value is in seconds. .SS "identify" .IX Subsection "identify" If called in a list context; returns an AoH filled with \&\s-1CPU\s0 metadata. If called in a scalar context, returns the name of the \s-1CPU\s0 (if \s-1CPU\s0 is multi-core or there are multiple CPUs, it'll also include the number of CPUs). .PP Returns \f(CW\*(C`undef\*(C'\fR upon failure. .SS "speed" .IX Subsection "speed" Returns the \s-1CPU\s0 clock speed in MHz if successful. Returns \f(CW\*(C`undef\*(C'\fR otherwise. .SS "count" .IX Subsection "count" Returns the number of CPUs (or number of total cores). .SS "bitness" .IX Subsection "bitness" If successful, returns the bitness ( \f(CW32\fR or \f(CW64\fR ) of the \s-1CPU.\s0 Returns false otherwise. .SS "load [, \s-1LEVEL\s0]" .IX Subsection "load [, LEVEL]" Returns the \s-1CPU\s0 load percentage if successful. Returns \f(CW\*(C`undef\*(C'\fR otherwise. .PP The average \s-1CPU\s0 load average in the last minute. If you pass a level argument, it'll return the related \s-1CPU\s0 load. .PP .Vb 2 \& use Sys::Info::Constants qw( :device_cpu ); \& printf "CPU Load: %s\en", $cpu\->load(DCPU_LOAD_LAST_01); .Ve .PP Load level constants: .PP .Vb 5 \& LEVEL MEANING \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& DCPU_LOAD_LAST_01 CPU Load in the last 1 minute \& DCPU_LOAD_LAST_05 CPU Load in the last 5 minutes \& DCPU_LOAD_LAST_10 CPU Load in the last 10 minutes .Ve .PP \&\f(CW\*(C`LEVEL\*(C'\fR defaults to \f(CW\*(C`DCPU_LOAD_LAST_01\*(C'\fR. .PP Using this method under \fIWindows\fR is not recommended since, the \f(CW\*(C`WMI\*(C'\fR interface will possibly take at least \f(CW2\fR seconds to complete the request. .SS "hyper_threading" .IX Subsection "hyper_threading" .SS "ht" .IX Subsection "ht" Returns the number of threads if hyper threading is supported, returns false otherwise. .SH "SEE ALSO" .IX Header "SEE ALSO" Sys::Info, Sys::Info::OS, Sys::Info::Device. .SH "AUTHOR" .IX Header "AUTHOR" Burak Gursoy .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2006 by Burak Gursoy. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.