I'm on a dual-CPU machine running version 5.10 and I'm trying to use kstat
info from a C++ program to calculate the CPU load. The 'kernel' and 'user'
tick values increase as expected with each subsequent access. The 'wait'
values are always 0 - that's probably normal for this program. But the
'idle' tick values stay constant. Likewise, if I run 'kstat' from the
command line repeatedly, the idle value is always the same while the related
values increase. My test program has sleep statements in it so I know the
machine cannot be fully utilized, and I can determine this by other means as
well. Anybody know what gives, and how I can get the necessary info if
indeed the 'idle' value isn't updated?
thanks,
Jeff Parsons
'wait' is no longer captured as a CPU figure in Solaris 10.
> But the
> 'idle' tick values stay constant.
What values are you examining? Is this 'cpu_ticks_idle' from each CPU?
Do you see the same values by running 'kstat' on the command line?
I cannot understand by 'cpu_ticks_idle' is not increasing. If you look
at 'mpstat' output, is the idle column non-zero?
--
Darren Dunham ddu...@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
"Darren Dunham" <ddu...@taos.com> wrote in message
news:kv3vj.2300$fX7...@nlpi061.nbdc.sbc.com...
> Jeff Parsons <j.pa...@vanderbilt.edu> wrote:
>> Hi,
>>
>> I'm on a dual-CPU machine running version 5.10 and I'm trying to use
>> kstat
>> info from a C++ program to calculate the CPU load. The 'kernel' and
>> 'user'
>> tick values increase as expected with each subsequent access. The 'wait'
>> values are always 0 - that's probably normal for this program.
>
> 'wait' is no longer captured as a CPU figure in Solaris 10.
>
>> But the
>> 'idle' tick values stay constant.
>
> What values are you examining? Is this 'cpu_ticks_idle' from each CPU?
I have a class that does the monitoring. It has members that are holders for
the kstat_ctl_t* returned from kstat_open(), the kstat_t* values I get by
iterating
over the kc_chain, and unsigned longs to hold the tick values. Inside the
iteration,
I check for ks_name strings that start with "cpu_stat" (this paraticular
machine has
"cpu_stat0" and "cpu_stat1"). For each match, the code below is executed.
cpu_stat_t &kstat_cpu = *((cpu_stat_t *) kstat_->ks_data);
kernel_ += kstat_cpu.cpu_sysinfo.cpu[CPU_KERNEL];
wait_ += kstat_cpu.cpu_sysinfo.cpu[CPU_WAIT];
user_ += kstat_cpu.cpu_sysinfo.cpu[CPU_USER];
idle_ += kstat_cpu.cpu_sysinfo.cpu[CPU_IDLE];
There is also code that checks the kstat id. If it changes during the
iteration, we
start over, and don't exit unless the whole thing is completed without a
change in the kstat id.
> Do you see the same values by running 'kstat' on the command line?
Yes
>
> I cannot understand by 'cpu_ticks_idle' is not increasing. If you look
> at 'mpstat' output, is the idle column non-zero?
The idle column has 9 for cpu0 and 8 for cpu1.
thanks,
Jeff
Okay, so if it's in both, it's unlikely to be a programming problem with
your code. I wonder if there's just something wrong with this machine.
Needs patching or something?
If you run this code, you get identical numbers for each run, that's
correct?
# kstat -m cpu_stat | grep 'idle '
idle 737864303
idle 738915673
# kstat -m cpu_stat | grep 'idle '
idle 737864627
idle 738915963
That's right:
/home/parsons: kstat -m cpu_stat | grep 'idle '
idle 147771597
idle 133244122
/home/parsons: kstat -m cpu_stat | grep 'idle '
idle 147771597
idle 133244122
I've heard of something called 'tickless idle' but in reference only
to Linux machines. I wonder if some versions of Solaris could have something
similar.
Jeff
> /home/parsons: kstat -m cpu_stat | grep 'idle '
> idle 147771597
> idle 133244122
> /home/parsons: kstat -m cpu_stat | grep 'idle '
> idle 147771597
> idle 133244122
I don't see how that's correct, *especially* since you're seeing idle
time appear in vmstat/mpstat.
I suppose you could go through and see whether the other states sum to
the actual time differences or if ticks are "missing", but I wouldn't
know what to do about it, whichever way it turned out.
Obviously idle ticks were accumulating up until some point in time, then
they stopped (or does the number go up occasionally throughout the day?)
Short of doing kernel debugging and getting very dtrace happy, I have no
further suggestions other than big clubs like 'reboot', 'patch', and
'reinstall'.
> I've heard of something called 'tickless idle' but in reference only
> to Linux machines. I wonder if some versions of Solaris could have something
> similar.
Not that I'm aware of....