Changeset 5161

Show
Ignore:
Timestamp:
03/24/08 17:16:15 (5 years ago)
Author:
khali
Message:

Cache the parsed hexdumps so that each dump file is only parsed once.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/eeprom/decode-dimms.pl

    r5160 r5161  
    4141use Fcntl qw(:DEFAULT :seek); 
    4242use vars qw($opt_html $opt_bodyonly $opt_igncheck $use_sysfs $use_hexdump 
    43             @vendors %decode_callback $revision @dimm_list); 
     43            @vendors %decode_callback $revision @dimm_list %hexdump_cache); 
    4444 
    4545$revision = '$Revision$ ($Date$)'; 
     
    11051105        my $word = 0; 
    11061106 
     1107        # Look in the cache first 
     1108        return @{$hexdump_cache{$_[0]}} if exists $hexdump_cache{$_[0]}; 
     1109 
    11071110        open F, '<', $_[0] or die "Unable to open: $_[0]"; 
    11081111        while (<F>) { 
     
    11391142        $header and die "Unable to parse any data from hexdump '$_[0]'"; 
    11401143        $word and printc "Warning: Assuming big-endian order 16-bit hex dump"; 
     1144 
     1145        # Cache the data for later use 
     1146        $hexdump_cache{$_[0]} = \@bytes; 
    11411147        return @bytes; 
    11421148}