SPMI (System Performance Measurement Interface)

SPMI (System Performance Measurement Interface)

Post by Marc Missir » Sat, 11 Dec 1999 04:00:00



Hi,

I am looking for an AIX version of Solaris' kstat family of calls,
to retrieve statistics for CPU idleness and virtual memory paging info.

My search has led me to libSpmi.a,  the AIX SPMI.

Some questions,  though:

1) You have to have read permission on /dev/mem to even
run SpmiInit().  And you have to be able to create the
/etc/Spmi_shm_hook
file if it does not exist already.  Is there any other system call or
set of calls
available to the average non-root user?

2)  Is SPMI a red herring for me,  and is there a simpler supported way
of doing this?
I tend to make things way too complicated if left to my own devices.

Thanks for any info/advice on this.

Here is a small Solaris C++ program which retrieves the info I want:

#include<iostream.h>
#include<errno.h>
#include<string.h>
#include<kstat.h>
#include<sys/sysinfo.h>

int main()
{
    int rc;
    kstat_ctl_t *kstatControlStruct;
    ulong idle, rest, reads_and_writes, pages_in_and_out;

    // Initialize the kernel statistics library
    kstatControlStruct=kstat_open();
    if ( !kstatControlStruct )
    {
        cerr << strerror(errno) << endl;
        return 1;
    }

    // determine the number of CPUs
    // and read kstat data for each one
    int ncpu = 0;
    kstat_t *ksp;
    for ( ksp=kstatControlStruct->kc_chain; ksp != NULL;
ksp=ksp->ks_next)
    {
        if( strcmp( ksp->ks_module, "cpu_stat" ) == 0 )
        {
            ncpu++;
            if (kstat_read( kstatControlStruct, ksp, NULL ) < 0 )
            {
                cerr << strerror(errno) << endl;
                return 1;
            }
            cpu_stat_t   *percpu = (cpu_stat_t *)ksp->ks_data;
            idle =        percpu->cpu_sysinfo.cpu[CPU_IDLE] +
                          percpu->cpu_sysinfo.cpu[CPU_WAIT];
            rest =        percpu->cpu_sysinfo.cpu[CPU_USER] +
                          percpu->cpu_sysinfo.cpu[CPU_KERNEL];

            reads_and_writes =  percpu->cpu_sysinfo.bread +
                                percpu->cpu_sysinfo.bwrite;
            pages_in_and_out =  percpu->cpu_vminfo.pgpgin +
                                percpu->cpu_vminfo.pgpgout;
        }
    }
    cout << "Number of CPUs: " << ncpu << endl;
    cout << "idle: " << idle << endl;
    cout << "rest: " << rest << endl;
    cout << "reads_and_writes: " << reads_and_writes << endl;
    cout << "pages_in_and_out: " << pages_in_and_out << endl;

    // free resources associated with the kstat control
    // structure
    rc = kstat_close( kstatControlStruct);
    if ( rc )
    {
        cerr << strerror(errno) << endl;
        return 1;
    }

    return 0;

Quote:}

-------------------------------------------------------------------------

Thanks for any info!

-Marc

 
 
 

1. Performance Measurement Utilities, System V

I am looking for leads to persons or manuals that would
advance my knowledge of tuning system V for minimum overhead
as well as tuning the disk subsystem for maximum throughput.
I would also be interested in any information that describes
work load analysis, how to use performance tools, and housekeeping
techniques that reduce peak load and estimating capacity.

Thank you.
.
James R. Regan

2. ELF or aout, etc

3. performance measurements on unix-systems (V.3 680X0)

4. xterm and curses

5. Help:Performance measurements

6. NFS and microEmacs

7. Performance Measurement on the WAN

8. How to pinpoint mail server problem?

9. performance measurement for Pentium CPU

10. performance measurement tools

11. Performance measurements for Linux on PowerPC?

12. Process Group Performance Measurement

13. Looking for performance measurement tools