Changeset 1484

Show
Ignore:
Timestamp:
02/19/08 19:23:45 (4 years ago)
Author:
ssm
Message:

Add .info with device-mapper information, fix some typos

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • people/ssm/plugins/iostat/iostat_latency

    r1478 r1484  
    8383        if ($stats{$device}{'type'} eq 'disk') { 
    8484            foreach my $operation ("read", "write") {  
    85                 printf("%s_%s.label %s\n", $device, $operation, $device) 
    86                     if($stats{$device}{'active'}); 
    87             }  
     85                if($stats{$device}{'active'}) { 
     86                    # Label 
     87                    printf("%s_%s.label %s\n", $device, $operation, $device); 
     88                    # Info 
     89                    if ($stats{$device}{'info'}) { 
     90                        printf("%s_%s.info %s\n", $device, $operation, 
     91                               $stats{$device}{'info'}); 
     92                    } 
     93                }  
     94            } 
    8895        } 
    8996    } 
     
    99106        if ($stats{$device}{'type'} eq 'disk') { 
    100107            foreach my $operation ("read", "write") {  
    101                 printf("%s_%s.value %f\n", $device, $operation, 
    102                        &iotime(\%stats, $device, $operation)) 
    103                     if($stats{$device}{'active'}); 
     108                if($stats{$device}{'active'}) { 
     109                    printf("%s_%s.value %f\n", $device, $operation, 
     110                           &iotime(\%stats, $device, $operation)); 
     111                    } 
     112                 
    104113            } 
    105114        } 
     
    188197        # Find a device mapper name, for "dm-*" 
    189198        if ($diskstats{$device}{'major'} == $DM_MAJOR) { 
    190  
    191             ## XXX: Add metadata 
     199             
     200            my $info = &dm_name($diskstats{$device}{'major'}, 
     201                                $diskstats{$device}{'minor'}); 
     202 
     203            if ($info =~ /[0-9A-Za-z\-_+]/) { 
     204                $diskstats{$device}{'info'} = "Device-mapper: " . $info; 
     205                } 
    192206        } 
    193207         
     
    218232 
    219233    # Sanity check, both $major and $minor should be an integer 
    220     die unless ($major ~ /^\d+$/ && $minor ~ /^\d+$/); 
    221  
    222     # XXX: Run /sbin/dmsetup info --major $major --minor $minor, look 
    223     # for Name:.  (perlfaq8) 
    224  
    225 
     234    die unless ($major =~ /^\d+$/ && $minor =~ /^\d+$/); 
     235 
     236    my $foo = open(DMSETUP, "/sbin/dmsetup info --major $major --minor $minor |"); 
     237    while (<DMSETUP>) { 
     238        if (/^Name:\s+(\S+)/) { 
     239            return $1; 
     240        } 
     241    } 
     242 
     243