State filesizes in proper SI-notation.

This commit is contained in:
Alexander van Gessel 2008-11-03 04:02:36 +01:00
parent 3e6863c2ad
commit 3df044e3ff
6 changed files with 11 additions and 11 deletions

View File

@ -56,10 +56,10 @@ files.each { | file|
totalSavedBytes = totalSavedBytes + savedBytes
totalSavedFiles = totalSavedFiles.succ
output = `mv "#{file}.new.png" -v "#{file}"`
puts ",\nsaved: #{savedBytes} bytes, total saved: #{totalSavedBytes/1024} KB"
puts ",\nsaved: #{savedBytes} bytes, total saved: #{totalSavedBytes/1024} KiB"
else
File.unlink("#{file}.new.png");
end
}
puts "\ntotal saved: #{totalSavedBytes/1024} KB, #{totalSavedFiles} files\n";
puts "\ntotal saved: #{totalSavedBytes/1024} KiB, #{totalSavedFiles} files\n";

View File

@ -90,8 +90,8 @@ Select the add-on you want to install from the list and click "OK". The download
w("<td><b>%s</b><br/>" % name)
w("Version: %s<br/>" % v("version", "unknown"))
w("Author: %s</td>" % v("author", "unknown"))
MB = 1024 * 1024
w("<td>%.2fMB" % (float(v("size", "unknown")) / MB))
MiB = 1024 * 1024
w("<td>%.2fMiB" % (float(v("size", "unknown")) / MiB))
if url:
link = url.rstrip("/") + "/" + v("name") + ".tar.bz2"
w("<br/><a href=\"%s\">download</a></td>" % link)

View File

@ -898,7 +898,7 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex
int size = disp.screenshot(filename, map_screenshot);
if (size > 0) {
std::stringstream res;
res << filename << " ( " << size/1000000 <<" "<< (size/1000)%1000 << " KB )";
res << filename << " ( " << size/1000000 <<" "<< (size/1000)%1000 << " kB )";
gui::dialog(disp,_("Screenshot done"),res.str(),gui::MESSAGE).show();
} else
gui::dialog(disp,_("Screenshot failed"),"",gui::MESSAGE).show();

View File

@ -974,7 +974,7 @@ std::string get_bandwidth_stats(int hour)
ss << "Hour stat starting from " << hour << "\n " << std::left << std::setw(bandwidth_stats::type_width) << "Type of packet" << "| "
<< std::setw(bandwidth_stats::packet_width)<< "out #" << "| "
<< std::setw(bandwidth_stats::bytes_width) << "out kb" << "| "
<< std::setw(bandwidth_stats::bytes_width) << "out kb" << "| " /* Are these bytes or bits? base10 or base2? */
<< std::setw(bandwidth_stats::packet_width)<< "in #" << "| "
<< std::setw(bandwidth_stats::bytes_width) << "in kb" << "\n";

View File

@ -250,7 +250,7 @@ foreach my $campaign (@sorted) {
$size += 512;
$size -= $size % 1024;
$size /= 1024;
push @row, escapeHTML("$size KB");
push @row, escapeHTML("$size KiB");
push @row, escapeHTML($campaign->{'attr'}->{'downloads'});
push @rows, td(\@row);
}

View File

@ -89,7 +89,7 @@ optimize_imgfile()
total_savings_size=$((${total_savings_size}+${png_savings_size}))
total_savings_filecount=$((1+${total_savings_filecount}))
mv -f ${1}.new ${1}
echo " saved: ${png_savings_size} bytes, total saved: $((${total_savings_size}/1024)) KB"
echo " saved: ${png_savings_size} bytes, total saved: $((${total_savings_size}/1024)) KiB"
else
rm -f ${1}.new
echo " already optimized"
@ -106,9 +106,9 @@ print_statistics()
# Print overall statistics
if [ "$total_savings_filecount" -gt 0 ]; then
echo "Overall statistics (only for files with a smaller recompressed size):"
echo " Original size: $((${total_original_size}/1024)) KB on ${total_savings_filecount} files"
echo " Optimized size: $(((${total_original_size}-${total_savings_size})/1024)) KB"
echo " Total saving: $((${total_savings_size}/1024)) KB = $((${total_savings_size}*100/${total_original_size}))% decrease"
echo " Original size: $((${total_original_size}/1024)) KiB on ${total_savings_filecount} files"
echo " Optimized size: $(((${total_original_size}-${total_savings_size})/1024)) KiB"
echo " Total saving: $((${total_savings_size}/1024)) KiB = $((${total_savings_size}*100/${total_original_size}))% decrease"
else
echo "No files were recompressed."
fi