Sponsored Content
Top Forums UNIX for Advanced & Expert Users AIX - io info get from "libperfstat" not match "iostat" Post 302903678 by jackliang on Thursday 29th of May 2014 01:35:21 AM
Old 05-29-2014
AIX - io info get from "libperfstat" not match "iostat"

Hi, everyone.
I need to write a program to get io info based on libperfstat.
But the "write time" of a disk is just half of the value get from iostat.
I'm confused and can't explain. Help please.

How I calculate "write service time per sec":

In iostat:
Code:
 
        write service time per sec = wps * avgserv
        wps: write requests per sec
        avgserv: avg service time per write request

In my program:
Code:
        (new wserv - old wserv) / intervalTime

iostat cmd:
Code:
 iostat -D hdisk1 10

My C code :
Code:
    int i, ret, tot;
    perfstat_disk_t *statp;
    perfstat_id_t first;
    
    unsigned long long oldValue = 0;
    unsigned long long newValue = 0;
    int interval = 10;
    
    while (true) {
        /* check how many perfstat_disk_t structures are available */
        tot =  perfstat_disk(NULL, NULL, sizeof(perfstat_disk_t), 0);
    
        /* allocate enough memory for all the structures */
        statp = calloc(tot, sizeof(perfstat_disk_t));
    
        /* set name to first interface */
        strcpy(first.name, FIRST_DISK);
    
        /* ask to get all the structures available in one call */
        /* return code is number of structures returned */
        ret = perfstat_disk(&first, statp,
            sizeof(perfstat_disk_t), tot);
    
        /* print statistics for each of the disks */
        for (i = 0; i < ret; i++) {
            if (strcmp(statp[i].name, "hdisk1") == 0) {
                printf("\nStatistics for disk : %s\n", statp[i].name);
                printf("-------------------\n");
                newValue = statp[i].wserv;
                printf("write time : %llu /s\n", (newValue - oldValue)/interval);
                oldValue = newValue;
            }
        }
    
        sleep(interval); // sleep 10s
    }

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

5. AIX

How to enable "TCP MD5 Signatures" and "https" on AIX?

I have searched many times but nothing found. Somebody help please :(:(:( (1 Reply)
Discussion started by: bobochacha29
1 Replies

6. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

7. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

8. Shell Programming and Scripting

Search file containing ps results for a match "my.cnf" and then for a second match . "ok:" and

I need to find two matches in the output from ps. I am searching with ps -ef |grep mysql for: my.cnf /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/mysql/master/agis_core/etc/my.cnf after this match I want to search back and match the hostname which is x number of lines back, above the... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
rstat(3RPC)						       RPC Library Functions						       rstat(3RPC)

NAME
rstat, havedisk - get performance data from remote kernel SYNOPSIS
cc [ flag ... ] file ... -lrpcsvc [ library ... ] #include <rpc/rpc.h> #include <rpcsvc/rstat.h> enum clnt_stat rstat(char *host, struct statstime *statp); int havedisk(char *host); PROTOCOL
/usr/include/rpcsvc/rstat.x DESCRIPTION
These routines require that the rpc.rstatd(1M) daemon be configured and available on the remote system indicated by host. The rstat() pro- tocol is used to gather statistics from remote kernel. Statistics will be available on items such as paging, swapping, and cpu utiliza- tion. rstat() fills in the statstime structure statp for host. statp must point to an allocated statstime structure. rstat() returns RPC_SUCCESS if it was successful; otherwise a enum clnt_stat is returned which can be displayed using clnt_perrno(3NSL). havedisk() returns 1 if host has disk, 0 if it does not, and -1 if this cannot be determined. The following XDR routines are available in librpcsvc: xdr_statstime xdr_statsvar ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
rup(1), rpc.rstatd(1M), rpc_clnt_calls(3NSL), attributes(5) SunOS 5.11 30 Dec 1996 rstat(3RPC)
All times are GMT -4. The time now is 07:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy