Topic
  • 8 replies
  • Latest Post - ‏2013-03-07T17:35:31Z by SystemAdmin
MarcelMol
MarcelMol
5 Posts

Pinned topic perfsat api and tape drives

‏2011-05-09T10:04:32Z |
Hi all,

I like to get tape statistics using the perfstat api.
When I use the perfstat_tape() function I can figure out the number of tape drives
but when getting the actual data it looks as if it tries to retrieve disk info....

It can be demonstrated using the perfstat documentation example program for tapes:

#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/protosw.h>
#include <libperfstat.h>
int main (int argc, char *argv[])
{
int ret, tot, i;
perfstat_tape_t *statp;
perfstat_id_t first;

/* get tape drive count*/
if ((tot = perfstat_tape(NULL, NULL, sizeof(perfstat_tape_t), 0)) <= 0) {
printf("probably no tape drives in this system\n");
exit(-1);
}
printf("%d tape drives\n", tot);

statp = calloc(tot, sizeof(perfstat_tape_t));
strcpy(first.name, NULL);

/* get all tape drive data */
if ((ret = perfstat_tape(&first, statp, sizeof(perfstat_tape_t), tot)) <= 0) {
perror("perfstat_tape");
exit(-1);
}

for (i=1; i<=tot; i++, statp++) {
printf("tape :%s\n", statp->description);
printf("Total size :%lluMB\n", statp->size);
printf("free portion :%lluMB\n", statp->free);
printf("Read transfers :%llu\n", statp->rxfers);
printf("Total transfers :%llu\n", statp->xfers);
printf("Blocks written :%llu\n", statp->wblks);
printf("Blocks read :%llu\n", statp->rblks);
printf("Active time :%llu\n\n\n", statp->time);
}
}

Running this on a system with tape drives gives the following output:

114 tape drives
tape :16 Bit LVD SCSI Disk Drive
Total size :69888MB
free portion :42880MB
Read transfers :0
Total transfers :32309360
Blocks written :391987069
Blocks read :1169419
Active time :16071512
tape :16 Bit LVD SCSI Disk Drive
Total size :69888MB
free portion :42624MB
Read transfers :0
Total transfers :37638058
Blocks written :365139203
Blocks read :663860260
Active time :17552539
tape :MPIO FC 2145
Total size :511488MB
free portion :0MB
Read transfers :0
Total transfers :46524226
Blocks written :10977870504
Blocks read :12652981829
Active time :30543406
.... further entries deleted ....

iostat -p on the same system gives:

System configuration: lcpu=8 tapes=114

Tapes: % tm_act Kbps tps Kb_read Kb_wrtn
rmt144 0.2 2539.3 9.9 2074934824 2100364806
rmt145 0.1 372.7 1.5 128566567 484238881
rmt146 0.1 528.6 2.1 4782610 864405475
..... further entries deleted ....
running truss on both commands shows the perfstat calls are translated to ptx_ calls:

filtered truss output from iostat:

ptx_config(0x80000001, 0x00000000, 0x217E439C, 0x0000D032, 0x00000000, 0x0000018E, 0x00000000, 0x00000000) = 0x00000000
ptx_get_numtapedkstats(0x217E1AC8, 0x00000008, 0x217E439C, 0x0000D032, 0x00000000, 0x000001D3, 0x00000000, 0x00000000) = 0x00000000
ptx_get_cpuinfo(0xFFFFFFFF, 0x00000000, 0x217E439C, 0x0000D032, 0x00000000, 0x0000013E, 0x00000000, 0x00000000) = 0x00000008
ptx_get_tapedkstats(0x217ED508, 0x00000072, 0x217E1BE4, 0x00000000, 0x00000000, 0x00000000, 0x0000006A, 0x200018E4) = 0x00000000
ptx_get_sysstats(0x20008C28, 0x00000000, 0x008B10E4, 0x0000D032, 0x00000000, 0x0000014B, 0x00000000, 0x00000000) = 0x00000000
ptx_get_sysinfo(0x20007E50, 0x00000000, 0x217E439C, 0x0000D032, 0x00000000, 0x0000014C, 0x00000000, 0x00000000) = 0x00000000
ptx_config(0x40000001, 0x00000000, 0x00000000, 0x00000000, 0x218075E0, 0x0000A640, 0xF067CF04, 0xF067CF24) = 0x00000000
filtered truss output from sample program

ptx_get_numtapedkstats(0x2FF228B0, 0x00000000, 0x200038CC, 0x0000D032, 0x00000000, 0x00000141, 0x00000000, 0x00000000) = 0x00000000
ptx_get_dkstats_diskname(0x20013428, 0x00000072, 0x2FF228C0, 0x2FF228BC, 0x00000000, 0x00000000, 0x00000000, 0x20009758) = 0x00000000
Apperantly iostat does quite different things. The sample program calls ptx_get_dkstats_diskname() wheras iostat calls ptx_get_tapedkstats() and also calls ptx_config().
Does anyone know how to properly get tape statistics using the perfstat api?

Thanks,

-Marcel
Updated on 2013-03-07T17:35:31Z at 2013-03-07T17:35:31Z by SystemAdmin
  • nagger
    nagger
    1648 Posts

    Re: perfsat api and tape drives

    ‏2011-05-25T03:23:51Z  
    Hi,
    What level of AIX are you running?
    like oslevel -s

    This does look like a bug - my first thought is have you got the latest TL and service packs
    as you might be running an older release that has already been fixed and fixed perhaps years ago!!

    Failing that you can make a AIX support call and raise a PMR.

    thanks Nigel
  • MarcelMol
    MarcelMol
    5 Posts

    Re: perfsat api and tape drives

    ‏2011-05-26T06:22:07Z  
    • nagger
    • ‏2011-05-25T03:23:51Z
    Hi,
    What level of AIX are you running?
    like oslevel -s

    This does look like a bug - my first thought is have you got the latest TL and service packs
    as you might be running an older release that has already been fixed and fixed perhaps years ago!!

    Failing that you can make a AIX support call and raise a PMR.

    thanks Nigel
    running a recent aix 6.1: 6100-06-03-1048

    compiled using gcc 4.4.5

    all other perfstat calls (disk, diskpaths, diskadapter, cpuinfo, memory etc) work fine
    except the perfstat_tape calls...

    Nigel, whats the code path in nmon to get tape stats?

    Thanks,

    -Marcel
  • nagger
    nagger
    1648 Posts

    Re: perfsat api and tape drives

    ‏2011-05-28T16:44:33Z  
    • MarcelMol
    • ‏2011-05-26T06:22:07Z
    running a recent aix 6.1: 6100-06-03-1048

    compiled using gcc 4.4.5

    all other perfstat calls (disk, diskpaths, diskadapter, cpuinfo, memory etc) work fine
    except the perfstat_tape calls...

    Nigel, whats the code path in nmon to get tape stats?

    Thanks,

    -Marcel
    Eh?
    1. nmon does not do tape stats!
    2. topas_nmon does but that does not use the perfstat libraries directly.
    3. nmon does Fibre Channel tape drives in the sense of monitoring Fibre Channels.

    I compiled your program using the IBM compiler - no errors or warnings - on AIX 6.1 TL4 SP3.
    Then ran it:
    
    $ ./tape probably no tape drives in 
    
    this system
    


    This is inconclusive - it might be your compiler or AIX releases.

    I don't have a suitable tape drive - this API only supports a very limited number of specific drives.
    What drive have you got connected?

    Fancy downloading the trial version of the IBM compiler?

    Thanks Nigel Griffiths
  • MarcelMol
    MarcelMol
    5 Posts

    Re: perfsat api and tape drives

    ‏2011-05-30T11:46:30Z  
    • nagger
    • ‏2011-05-28T16:44:33Z
    Eh?
    1. nmon does not do tape stats!
    2. topas_nmon does but that does not use the perfstat libraries directly.
    3. nmon does Fibre Channel tape drives in the sense of monitoring Fibre Channels.

    I compiled your program using the IBM compiler - no errors or warnings - on AIX 6.1 TL4 SP3.
    Then ran it:
    <pre class="jive-pre"> $ ./tape probably no tape drives in this system </pre>

    This is inconclusive - it might be your compiler or AIX releases.

    I don't have a suitable tape drive - this API only supports a very limited number of specific drives.
    What drive have you got connected?

    Fancy downloading the trial version of the IBM compiler?

    Thanks Nigel Griffiths
    eh ok, thought topas_nmon came from your hands and more or less expected it to use perfstat.

    Do you know what api/syscalls it uses for tape stats.

    Am I correct iostat doesn't uses perfstat either? At least it uses some lowlevel calls that perfstat also uses.

    My (ehr, the IBM perfstat documentation) sample program correctly reports the number of tape drives but fails to get the detailed data.
    So the outcome on your system seems ok if you do not have tape drives on it.

    I'll try with a trial version of the C compiler.
  • churchey
    churchey
    5 Posts

    Re: perfsat api and tape drives

    ‏2011-05-30T12:01:08Z  
    Why not use the iostat -p and -dp to get the tape stats desired via the nmon exit script and make TAPExxx records.
    We've been doing this for 1-2 years and it's been fine, once the correct ATAPE driver is used.
  • MarcelMol
    MarcelMol
    5 Posts

    Re: perfsat api and tape drives

    ‏2011-05-30T12:15:39Z  
    • MarcelMol
    • ‏2011-05-30T11:46:30Z
    eh ok, thought topas_nmon came from your hands and more or less expected it to use perfstat.

    Do you know what api/syscalls it uses for tape stats.

    Am I correct iostat doesn't uses perfstat either? At least it uses some lowlevel calls that perfstat also uses.

    My (ehr, the IBM perfstat documentation) sample program correctly reports the number of tape drives but fails to get the detailed data.
    So the outcome on your system seems ok if you do not have tape drives on it.

    I'll try with a trial version of the C compiler.
    Ok downloaded vac 11.1 but unfortunately (or not :) it did not help.
    Comparing truss output from the vac version and gcc version shows they do exactly the same thing.
    114 tape drives
    tape :16 Bit LVD SCSI Disk Drive
    Total size :69888MB
    free portion :42880MB
    Read transfers :0
    Total transfers :70375036
    Blocks written :788608535
    Blocks read :1558526
    Active time :35105686
    tape :16 Bit LVD SCSI Disk Drive
    Total size :69888MB
    free portion :42624MB
    Read transfers :0
    Total transfers :79818225
    Blocks written :761760581
    Blocks read :1378570775
    Active time :37394230

    ... other entries deleted...
  • MarcelMol
    MarcelMol
    5 Posts

    Re: perfsat api and tape drives

    ‏2011-05-30T12:23:00Z  
    • churchey
    • ‏2011-05-30T12:01:08Z
    Why not use the iostat -p and -dp to get the tape stats desired via the nmon exit script and make TAPExxx records.
    We've been doing this for 1-2 years and it's been fine, once the correct ATAPE driver is used.
    Yes iostat/nmon could be used, but I want to do it differently.
    For one thing running iostat and processing the output with shell script, grep, awk, etc is
    expensive. Processing with perl does a better job but still.
    Why does IBM release api information about perfstat when it looks lik eyou can not use it.
  • SystemAdmin
    SystemAdmin
    2402 Posts

    Re: perfsat api and tape drives

    ‏2013-03-07T17:35:31Z  
    • MarcelMol
    • ‏2011-05-26T06:22:07Z
    running a recent aix 6.1: 6100-06-03-1048

    compiled using gcc 4.4.5

    all other perfstat calls (disk, diskpaths, diskadapter, cpuinfo, memory etc) work fine
    except the perfstat_tape calls...

    Nigel, whats the code path in nmon to get tape stats?

    Thanks,

    -Marcel
    > MarcelMol wrote:
    > running a recent aix 6.1: 6100-06-03-1048
    >
    > compiled using gcc 4.4.5
    >
    > all other perfstat calls (disk, diskpaths, diskadapter, cpuinfo, memory etc) work fine
    > except the perfstat_tape calls...
    >
    > Nigel, whats the code path in nmon to get tape stats?
    >
    > Thanks,
    >
    > -Marcel

    How did you compile with gcc? On AIX 6.1 with gcc 4.7.2 I get messages like this
    /usr/include/netinet/in6_var.h:65:29: error: array type has incomplete element type

    Looking at that header I see
    extern CONST struct protosw inet6sw[];

    Was there a flag or language setting you used to get a successful build?