6.13. Using the Perl Kstat API to Look at Memory StatisticsYou can also obtain kstat statistics through the Perl kstat API. With that approach, you can write simple scripts to collect the statistics. For example, below we display statistics for Section 6.4.2 quite easily by using the system_pages statistics. %{$now} = %{$kstats->{0}{system_pages}}; print "$now->{pagesfree}\n"; Using a more elaborate script, we read the values for physmem, pp_kernel, and pagesfree and report them at regular intervals. $ wget http://www.solarisinternals.com/si/downloads/prtmem.pl $ prtmem.pl 10 prtmem started on 04/01/2005 15:46:13 on d-mpk12-65-100, sample interval 5 seconds Total Kernel Delta Free Delta 15:46:18 2040 250 0 972 -12 15:46:23 2040 250 0 968 -3 15:46:28 2040 250 0 968 0 15:46:33 2040 250 0 970 1 ... |