Lib-CPUInfo

 view release on metacpan or  search on metacpan

lib/Lib/CPUInfo.pm  view on Meta::CPAN

=head2 C<get_l1d_cache($index)>

    my $index = 0;
    my $cache = get_l1d_cache($index);

Return the L<Lib::CPUInfo::Cache> L1d cache object at index C<$index>.

=head2 C<get_l2_cache($index)>

    my $index = 0;
    my $cache = get_l2_cache($index);

Return the L<Lib::CPUInfo::Cache> L2 cache object at index C<$index>.

=head2 C<get_l3_cache($index)>

    my $index = 0;
    my $cache = get_l3_cache($index);

Return the L<Lib::CPUInfo::Cache> L3 cache object at index C<$index>.

=head2 C<get_l4_cache($index)>

    my $index = 0;
    my $cache = get_l4_cache($index);

Return the L<Lib::CPUInfo::Cache> L4 cache object at index C<$index>.

=head2 C<get_max_cache_size>

    my $size = get_max_cache_size();

Get the max cache size.

=head2 C<get_current_uarch_index>

    my $index = get_current_uarch_index();

Get the current UArch index, I guess?

=head2 C<get_current_core>

    my $core = get_current_core();

Get the current L<Lib::CPUInfo::Core> core object.

=head2 C<get_current_processor>

    my $processor = get_current_processor();

Get the current L<Lib::CPUInfo::Processor> processor object.

=head1 BENCHMARKS

=over 4

=item * Counting number of CPUs

Loops: 1,000.

    Lib::CPUInfo:           Ran 21 iterations (1 outliers).
    Lib::CPUInfo:           Rounded run time per iteration: 4.163e-04 +/- 1.5e-06 (0.4%)

    Sys::Info::Device::CPU: Ran 25 iterations (5 outliers).
    Sys::Info::Device::CPU: Rounded run time per iteration: 9.4582e-01 +/- 2.9e-04 (0.0%)

    Rex::Inventory::Proc:   Ran 21 iterations (0 outliers).
    Rex::Inventory::Proc:   Rounded run time per iteration: 5.790e-01 +/- 1.1e-03 (0.2%)

=item * Getting the CPU package name

Loops: 1,000.

    Lib::CPUInfo:           Ran 23 iterations (3 outliers).
    Lib::CPUInfo:           Rounded run time per iteration: 1.2206e-02 +/- 1.3e-05 (0.1%)

    Sys::Info::Device::CPU: Ran 23 iterations (3 outliers).
    Sys::Info::Device::CPU: Rounded run time per iteration: 9.6313e-01 +/- 1.0e-03 (0.1%)

=back

=head1 COVERAGE

    -------------- ------ ------ ------ ------ ------ ------ ------
    File             stmt   bran   cond    sub    pod   time  total
    -------------- ------ ------ ------ ------ ------ ------ ------
    Lib/CPUInfo.pm  100.0    n/a   63.6  100.0  100.0  100.0   93.5
    Total           100.0    n/a   63.6  100.0  100.0  100.0   93.5
    -------------- ------ ------ ------ ------ ------ ------ ------

=head1 SEE ALSO

This module uses L<FFI::Platypus> to connect to the C library and
L<FFI::C> to define the object structs.

These modules also retrieve CPU information:

=over 4

=item * L<Sys::Info>

=item * L<Proc::CPUUsage>

=item * L<Rex::Inventory::Proc>

=item * L<Linux::Cpuinfo>

=item * L<Linux::Proc::Cpuinfo>

=item * L<Linux::Info::CpuStats>

=back

=head1 AUTHOR

Sawyer X

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Sawyer X.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.693 second using v1.01-cache-2.11-cpan-71847e10f99 )