06-15-2005
Even with a question like... no mention of which os is involved.
![Frown Smilie](https://www.unix.com/images/smilies/frown.gif)
There is no hope...
That looks like output from the SunOS kstat command. I really don't understand this kstat driver or kstat library on SunOS. Traditionally, this stuff would come from a sysinfo structure. "nm /dev/ksyms" shows that the sysinfo structure is there and the structure is documented in /usr/include/sys/sysinfo.h. So that is where I would expect SunOS to get this info. After studying the
sar source code which Sun so kindly made available yesterday, it does appear that you are looking at the right data.
So how did you figure this much out? Were you reading the source code too, or did you have some kstat reference?
Roughly, you read the numbers once. And then you wait. And then you read them again. Then you subtract the first numbers from the second to get an array of deltas. You have 10 instances so I guess you have 10 cpus. Consider just one instance. (Or maybe you want to add the instances together to get a system-wide view.) You add the deltas up and you have total number of times that any of the counters for that cpu incremented during the wait period. Now you figure out how much of the total each piece is. That gives the percentages over the wait period.
You know, you could just run "sar 1 4" or something.
10 More Discussions You Might Find Interesting
1. Solaris
Hi all,
I am working on the symbEL to get some specific value from the kernel recently. But I am not sure whether kvm and kstat have such specific value. i checked the examples included with the RICHPse but didn't get the answer. also the "kstat" seems not have any description.
Is there a... (2 Replies)
Discussion started by: sleepy_11
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent.
E.g : username empid
------------------------
sri 123
to
username,empid
sri,123
Thanks,
Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies
3. Shell Programming and Scripting
Hi all, I'd like to capture the output from the 'top' command to monitor my CPU and Mem utilisation.Currently my command isecho date
`top -b -n1 | grep -e Cpu -e Mem` I get the output in 3 separate lines.Tue Feb 24 15:00:03
Cpu(s): 3.4% us, 8.5% sy .. ..
Mem: 1011480k total, 226928k used, ....... (4 Replies)
Discussion started by: new2ss
4 Replies
4. Solaris
We used kstat on netra240/440 to check if the link is full duplex. So we do something like:
bash-3.00# kstat -pc net bge:1::/'link_duplex'/ | cut -f2
2
The output 2 indicates the link is full duplex. This kind of check worked all right for Netra 240/440 systems.
However, the nxge... (2 Replies)
Discussion started by: illcar
2 Replies
5. Solaris
I have a server on Solaris 8 who had a sudden reboot once and now the messages log is filled with these errors:
Mar 23 02:14:42 srt-hlr-b unix: NOTICE: kstat_create('unix', 0, 'icmp_minor_1'): cannot create kstat before kstat_init()
Mar 23 02:14:42 srt-hlr-b unix: NOTICE: kstat_create('vmem',... (10 Replies)
Discussion started by: StarSol
10 Replies
6. Solaris
I'm having a little trouble understanding the output I'm seeing from kstat for the "net" class. I'm seeing a lot of entries with "mac" as the name, like this.
module: bge instance: 3
name: mac class: net
... (3 Replies)
Discussion started by: Midcain
3 Replies
7. Shell Programming and Scripting
Hello,
I need help with a perl script that will process a text file and match virtual server name to profile(s). the rest will be ignored.
Virtual server name follows the word "virtual" in the begging of the line.
There could be multiple profiles assigned to one virtual server.
For example, ... (3 Replies)
Discussion started by: besogon
3 Replies
8. Shell Programming and Scripting
Hi guys, need a guide to format desire output result here. Please guide me. Thanks in advance.
2012-08-30 00:01:56,554 DEBUG - Sending message<TTT232MM0N048YCI TTPC TTOF1A 289171092679389OOLU 1562340 TPM 641 KT$YES 20120830000156KK 12012301??????000011YGY> to... (7 Replies)
Discussion started by: ment0smintz
7 Replies
9. Shell Programming and Scripting
Hi folks
I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file.
It all works - apart from the xml and config file format in the new file
with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies
10. Shell Programming and Scripting
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies
LEARN ABOUT OPENSOLARIS
kstat
kstat(9S) Data Structures for Drivers kstat(9S)
NAME
kstat - kernel statistics structure
SYNOPSIS
#include <sys/types.h>
#include <sys/kstat.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI)
DESCRIPTION
Each kernel statistic (kstat) exported by device drivers consists of a header section and a data section. The kstat structure is the header
portion of the statistic.
A driver receives a pointer to a kstat structure from a successful call to kstat_create(9F). Drivers should never allocate a kstat struc-
ture in any other manner.
After allocation, the driver should perform any further initialization needed before calling kstat_install(9F) to actually export the
kstat.
STRUCTURE MEMBERS
void *ks_data; /* kstat type-specif. data */
ulong_t ks_ndata; /* # of type-specif. data
records */
ulong_t ks_data_size; /* total size of kstat data
section */
int (*ks_update)(struct kstat *, int);
void *ks_private; /* arbitrary provider-private
data */
void *ks_lock; /* protects kstat's data */
The members of the kstat structure available to examine or set by a driver are as follows:
ks_data Points to the data portion of the kstat. Either allocated by kstat_create(9F) for the drivers use, or by the driver if it
is using virtual kstats.
ks_ndata The number of data records in this kstat. Set by the ks_update(9E) routine.
ks_data_size The amount of data pointed to by ks_data. Set by the ks_update(9E) routine.
ks_update Pointer to a routine that dynamically updates kstat. This is useful for drivers where the underlying device keeps cheap
hardware statistics, but where extraction is expensive. Instead of constantly keeping the kstat data section up to date,
the driver can supply a ks_update(9E) function that updates the kstat data section on demand. To take advantage of this
feature, set the ks_update field before calling kstat_install(9F).
ks_private Is a private field for the driver's use. Often used in ks_update(9E).
ks_lock Is a pointer to a mutex that protects this kstat. kstat data sections are optionally protected by the per-kstat ks_lock.
If ks_lock is non-NULL, kstat clients (such as /dev/kstat) will acquire this lock for all of their operations on that
kstat. It is up to the kstat provider to decide whether guaranteeing consistent data to kstat clients is sufficiently
important to justify the locking cost. Note, however, that most statistic updates already occur under one of the
provider's mutexes. If the provider sets ks_lock to point to that mutex, then kstat data locking is free. ks_lock is
really of type (kmutex_t*) and is declared as (void*) in the kstat header. That way, users do not have to be exposed to
all of the kernel's lock-related data structures.
SEE ALSO
kstat_create(9F)
Writing Device Drivers
SunOS 5.11 4 Apr 1994 kstat(9S)