Changeset 576
- Timestamp:
- 07/03/07 18:11:47 (2 years ago)
- Files:
-
- trunk/api/perl/ChangeLog (modified) (1 diff)
- trunk/api/perl/lib/Cache/Memcached.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/api/perl/ChangeLog
r574 r576 1 * update the stats method, including tests for it 2 (Ronald J Kimball <rkimball+memcached@pangeamedia.com>) 3 1 4 * arguments to 'new' constructor can be %hash or $hashref now 2 5 (previously was only $hashref) trunk/api/perl/lib/Cache/Memcached.pm
r574 r576 831 831 } 832 832 833 my %misc_keys = map { $_ => 1 } 834 qw/ bytes bytes_read bytes_written 835 cmd_get cmd_set connection_structures curr_items 836 get_hits get_misses 837 total_connections total_items 838 /; 839 833 840 # Now handle the other types, passing each type to each host server. 834 841 my @hosts = @{$self->{'buckets'}}; 835 my %malloc_keys = ( );836 842 HOST: foreach my $host (@hosts) { 837 843 my $sock = $self->sock_to_host($host); … … 863 869 $stats_hr->{'hosts'}{$host}{$typename}{$key} = $value; 864 870 } 865 $malloc_keys{$key} = 1 if $key && $typename eq 'malloc'; 871 $stats_hr->{'total'}{$key} += $value 872 if $typename eq 'misc' && $key && $misc_keys{$key}; 873 $stats_hr->{'total'}{"malloc_$key"} += $value 874 if $typename eq 'malloc' && $key; 866 875 } 867 876 } else { … … 872 881 $stats_hr->{'hosts'}{$host}{$typename} .= "$lines"; 873 882 } 874 }875 }876 877 # Now get the sum total of applicable values. First the misc values.878 foreach my $stat (qw(879 bytes bytes_read bytes_written880 cmd_get cmd_set connection_structures curr_items881 get_hits get_misses882 total_connections total_items883 )) {884 $stats_hr->{'total'}{$stat} = 0;885 foreach my $host (@hosts) {886 $stats_hr->{'total'}{$stat} +=887 $stats_hr->{'hosts'}{$host}{'misc'}{$stat};888 }889 }890 891 # Then all the malloc values, if any.892 foreach my $malloc_stat (keys %malloc_keys) {893 $stats_hr->{'total'}{"malloc_$malloc_stat"} = 0;894 foreach my $host (@hosts) {895 $stats_hr->{'total'}{"malloc_$malloc_stat"} +=896 $stats_hr->{'hosts'}{$host}{'malloc'}{$malloc_stat};897 883 } 898 884 }
