File: size.pl

package info (click to toggle)
libkiokudb-perl 0.57-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,396 kB
  • sloc: perl: 13,314; makefile: 12
file content (43 lines) | stat: -rw-r--r-- 1,007 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

use strict;
use warnings;

use Test::TempDir;
use Path::Class;
use Storable qw(nstore retrieve);
use Scalar::Util qw(blessed);

use KiokuDB;

my $f = (require KiokuDB::Test::Fixture::ObjectGraph)->new;

sub construct {
    $f->create;
}

sub run {
    my $dir = dir(tempdir);

    #my $files = KiokuDB->connect("files:dir=" . $dir->subdir("files"), create => 1, global_lock => 1 );
    my $bdb = KiokuDB->connect("bdb:dir=" . $dir->subdir("bdb"), create => 1 );
    #my $sqlite = KiokuDB->connect("dbi:SQLite:dbname=" . $dir->file("sqlite.db"), serializer => "storable" );

    #$sqlite->backend->dbh->do("PRAGMA default_synchronous = OFF");

    #$sqlite->backend->deploy;

    for ( my $i = 1; 1; $i++ ) {
        foreach my $b ( $bdb ) {
            $b->txn_do(sub {
                my $s = $b->new_scope;
                $b->insert(construct()) for 1 .. 20;
            });
        }

        warn "iteration $i\n";
        system("du -sh ${dir}/bdb/objects ${dir}/*");
    }
}

run();