display storable size
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 27 May 2010 16:19:05 +0000 (18:19 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 27 May 2010 16:26:54 +0000 (18:26 +0200)
This allows us to identify which dumps are available and how much
memory will they use when loaded (or even compare file size between
source file format and our storable serialization)

lib/MojoFacets/Data.pm
public/mojo_facets.css
templates/data/index.html.ep

index 6286671..78a6da0 100644 (file)
@@ -37,11 +37,15 @@ sub index {
        my $size;
        $size->{$_} = -s "$path/$_" foreach @files;
 
+       my $dump_path;
+       $dump_path->{$_} = $self->_dump_path( $_ ) foreach @files;
+
        $self->render(
                files => [ @files ],
                size => $size,
                loaded => $loaded,
                filters => $filters,
+               dump_path => $dump_path,
        );
 }
 
index 80c8c76..13402f0 100644 (file)
@@ -150,3 +150,9 @@ span.d {
 form.action_filter {
        float: right;
 }
+
+.bytes {
+       text-align: right;
+       font-family: monospace;
+       color: #444;
+}
index d0272b4..bc7216e 100644 (file)
@@ -6,14 +6,16 @@
 <input type=submit value="Load">
 
 <table>
-<tr><th>name</th><th title="on disk">bytes</th><th>items</th><th title="loaded in memory">m</th><th>columns</th></tr>
+<tr><th rowspan=2>name</th><th colspan=2>size</th><th rowspan=2>items</th><th rowspan=2 title="loaded in memory">m</th><th>columns</th></tr>
+<tr><th>disk</th><th>storable</th></tr>
 % foreach my $n ( @$files ) {
 <tr><td>
 <label>
 <input name=path  type=radio    value="<%= $n %>" <%= defined $loaded->{session('path')}->{data} eq $n ? 'disabled' : '' %>>
 <%= $n %>
 </label>
-</td><td align=right><%= $size->{$n} %>
+</td><td class=bytes><%= $size->{$n} %>
+</td><td class=bytes><%= -s $dump_path->{$n} %>
 </td><td align=right><%= defined $loaded->{$n}->{data} ? $#{ $loaded->{$n}->{data}->{items} } + 1 : '' %>
 </td><td><input name=paths type=checkbox value="<%= $n %>" <%= defined $loaded->{$n}->{stats} ? 'checked' : '' %>>
 </td><td>
@@ -33,3 +35,4 @@
 
 <pre class=debug><%= dumper $loaded %></pre>
 <pre class=debug><%= dumper $filters %></pre>
+<pre class=debug><%= dumper $dump_path %></pre>