Re: ssCpuRaw*: wait, kernel, and interrupt 'may be included in system': for Solaris/Linux are they included in ssCpuRawSystem? is there documentation for when they are and when they are not?
"Dave Shield" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
On 05/03/2008, Max <[email protected]> wrote: > I admittedly haven't checked the code yet, but does anyone on this > list know if for Linux the System CPU counter does include the > additional wait, interrupt, and kernel metrics or are they counted > separately? That's really a question for the Linux kernel people. The Linux code for this is effectively: read("/proc/stat", buff); sscanf(buff, "%llu %llu %llu %llu %llu %llu %llu", &cusell, &cicell, &csysll, &cidell, &ciowll, &cirqll, &csoftll); cpu->user_ticks = (unsigned long)cusell; cpu->nice_ticks = (unsigned long)cicell; cpu->sys_ticks = (unsigned long)csysll; cpu->idle_ticks = (unsigned long)cidell; cpu->wait_ticks = (unsigned long)ciowll; cpu->intrpt_ticks = (unsigned long)cirqll; cpu->sirq_ticks = (unsigned long)csoftll; (with those last three being 0 for 2.4 kernels). So we're really just reporting the contents of /proc/stat > How about Solaris? The equivalent code here is: kstat_read(kstat_fd, ksp, &cs); cpu2->user_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_USER]; cpu2->idle_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_IDLE]; cpu2->kern_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_KERNEL]; cpu2->wait_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_WAIT]; /* or cs.cpu_sysinfo.wait[W_IO]+cs.cpu_sysinfo.wait[W_PIO] */ cpu2->sys2_ticks = (unsigned long)cpu2->kern_ticks+cpu2->wait_ticks; /* nice_ticks, intrpt_ticks, sirq_ticks unused */ Note that system here is kernel + wait. This inconsistency is partly why I would like to define a new CPU MIB. That and a desire to support per-CPU statistics, rather than just the current overall figures. > RTFM responses with pointers of where I can start to look in the code > for the Solaris and Linux variants of the UCD MIB (if there are any) > are welcome as well! The clearest code is probably that under 'mibgroup/hardware/cpu', where there's a separate code file for each architecture. See the routine 'netsnmp_cpu_arch_load'. The contents of these are basically the same as those from the earlier 'mibgroup/ucd-snmp/vmstat*.c' files. Dave ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users