<commit_before>#!/usr/bin/perl
# invoke qemu's linux-user for a certain tag.
# env variables: QEMU_PATH, QEMU_ARCH

use warnings;
use strict;
use Cwd;

if (!defined($ENV{'QEMU_PATH'})) {
    die "Define QEMU_PATH environment variable. Stopped";
}
my $path = $ENV{'QEMU_PATH'};
if (! -d $path) {
    die "$path is not a directory. Stopped";
}

if (!defined($ENV{'QEMU_ARCH'})) {
    die "Define QEMU_ARCH environment variable, e.g. x86_64. Stopped";
}
my $arch = $ENV{'QEMU_ARCH'};

my $outfile = $ARGV[0] or die "No output file given. Stopped";

my $tag = $outfile;
$tag =~ s|.*/([^/]+)$|$1|;
$tag =~ s/\.nbench$//;

my $origdir = getcwd;
chdir($path) or die "cannot chdir($path): $!";
my $origtag = `git rev-parse HEAD`;
die "cannot invoke git at $path: $?" if ($?);

sys("git checkout $tag");
sys("make clean && make");
my $cmd = "$origdir/dbt-bench.pl $path/$arch-linux-user/qemu-$arch 1>$origdir/$outfile.tmp";
print "$cmd\n";
sys($cmd);
sys("echo \"dbt-bench: arch: $arch\" >> $origdir/$outfile.tmp");
my $host = `cat /proc/cpuinfo | grep 'model name' | head -1`;
chomp($host);
if ($?) {
    undef $host;
}
if ($host) {
    $host =~ s/[^:]*:\s*(.*)\s*$/$1/;
    sys("echo \"dbt-bench: host: $host\" >> $origdir/$outfile.tmp");
}
sys("git checkout $origtag");
chdir($origdir) or die "cannot chdir($origdir): $!";
sys("mv $outfile.tmp $outfile");

sub sys {
    my $cmd = shift(@_);
    system("$cmd") == 0 or die "cannot run '$cmd': $?";<commit_msg>qemu.pl: make clean + checkout + make<commit_after>#!/usr/bin/perl
# invoke qemu's linux-user for a certain tag.
# env variables: QEMU_PATH, QEMU_ARCH

use warnings;
use strict;
use Cwd;

if (!defined($ENV{'QEMU_PATH'})) {
    die "Define QEMU_PATH environment variable. Stopped";
}
my $path = $ENV{'QEMU_PATH'};
if (! -d $path) {
    die "$path is not a directory. Stopped";
}

if (!defined($ENV{'QEMU_ARCH'})) {
    die "Define QEMU_ARCH environment variable, e.g. x86_64. Stopped";
}
my $arch = $ENV{'QEMU_ARCH'};

my $outfile = $ARGV[0] or die "No output file given. Stopped";

my $tag = $outfile;
$tag =~ s|.*/([^/]+)$|$1|;
$tag =~ s/\.nbench$//;

my $origdir = getcwd;
chdir($path) or die "cannot chdir($path): $!";
my $origtag = `git rev-parse HEAD`;
die "cannot invoke git at $path: $?" if ($?);

sys("make clean");
sys("git checkout $tag");
sys("make");
my $cmd = "$origdir/dbt-bench.pl $path/$arch-linux-user/qemu-$arch 1>$origdir/$outfile.tmp";
print "$cmd\n";
sys($cmd);
sys("echo \"dbt-bench: arch: $arch\" >> $origdir/$outfile.tmp");
my $host = `cat /proc/cpuinfo | grep 'model name' | head -1`;
chomp($host);
if ($?) {
    undef $host;
}
if ($host) {
    $host =~ s/[^:]*:\s*(.*)\s*$/$1/;
    sys("echo \"dbt-bench: host: $host\" >> $origdir/$outfile.tmp");
}
sys("git checkout $origtag");
chdir($origdir) or die "cannot chdir($origdir): $!";
sys("mv $outfile.tmp $outfile");

sub sys {
    my $cmd = shift(@_);
    system("$cmd") == 0 or die "cannot run '$cmd': $?";
{'fraction_non_alphanumeric': 0.23270868824531515, 'fraction_numerical': 0.0068143100511073255, 'mean_word_length': 4.141856392294221, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3028705', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1174, 'n_words': 318}