display corresponding segment for markers in explorer
This commit is contained in:
@ -139,4 +139,52 @@ sub execute_query {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub format_number_sep {
|
||||||
|
my ($number) = @_;
|
||||||
|
1 while $number =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
||||||
|
return $number;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub elf_read_sections {
|
||||||
|
my ($elffile) = @_;
|
||||||
|
|
||||||
|
my $readelf_out = qx{readelf -S $elffile};
|
||||||
|
my @lines = split "\n", $readelf_out;
|
||||||
|
|
||||||
|
my @sections;
|
||||||
|
foreach my $line (@lines) {
|
||||||
|
|
||||||
|
# [ 1] .text PROGBITS 00100000 001000 0000f0 00 AX 0 0 4
|
||||||
|
next
|
||||||
|
unless $line =~
|
||||||
|
/^\s*\[\s*\d+\]\s+(\..+?)\s+([A-Z]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+.*$/;
|
||||||
|
|
||||||
|
push @sections, {
|
||||||
|
name => $1,
|
||||||
|
type => $2,
|
||||||
|
address => $3, # Memory location
|
||||||
|
offset => $4, # File location
|
||||||
|
size => $5,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return @sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_section_name {
|
||||||
|
my ( $address, @sections ) = @_;
|
||||||
|
|
||||||
|
my $name;
|
||||||
|
my $last_address = 0;
|
||||||
|
foreach my $section (@sections) {
|
||||||
|
my $cur_address = hex( $section->{address} );
|
||||||
|
if ( hex($address) >= $cur_address && $cur_address > $last_address ) {
|
||||||
|
$name = $section->{name};
|
||||||
|
$last_address = $cur_address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
@ -86,11 +86,8 @@ sub load_faults_csv {
|
|||||||
headers => 'auto'
|
headers => 'auto'
|
||||||
);
|
);
|
||||||
|
|
||||||
sub format_number_sep {
|
my @sections = Util::elf_read_sections(
|
||||||
my ($number) = @_;
|
"$local_archive_dir/$selected_experiment/system.elf");
|
||||||
1 while $number =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
|
||||||
return $number;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Result:
|
# Result:
|
||||||
# [ { benchmark => "ip", resulttype => "OK_MARKER",
|
# [ { benchmark => "ip", resulttype => "OK_MARKER",
|
||||||
@ -101,9 +98,12 @@ sub load_faults_csv {
|
|||||||
%marker_labels =
|
%marker_labels =
|
||||||
map {
|
map {
|
||||||
$_ => sprintf(
|
$_ => sprintf(
|
||||||
"%5s %10s %20s %15sx",
|
"%5s %10s %10s %20s %15sx",
|
||||||
$_->{benchmark}, $_->{fault_address},
|
$_->{benchmark},
|
||||||
$_->{resulttype}, format_number_sep( $_->{faults} ),
|
$_->{fault_address},
|
||||||
|
Util::get_section_name( $_->{fault_address}, @sections ),
|
||||||
|
$_->{resulttype},
|
||||||
|
Util::format_number_sep( $_->{faults} ),
|
||||||
);
|
);
|
||||||
} @marker_values;
|
} @marker_values;
|
||||||
}
|
}
|
||||||
@ -379,8 +379,8 @@ sub layout_resize {
|
|||||||
my $w = $win->width();
|
my $w = $win->width();
|
||||||
my $h = $win->height();
|
my $h = $win->height();
|
||||||
|
|
||||||
my $w1 = int( $w * 0.2 );
|
my $w1 = int( $w * 0.3 );
|
||||||
my $w2 = int( $w * 0.4 );
|
my $w2 = int( $w * 0.3 );
|
||||||
my $w3 = int( $w - $w1 - $w2 );
|
my $w3 = int( $w - $w1 - $w2 );
|
||||||
|
|
||||||
set_geometry( $left, 0, 1, $w1, $h - 2 );
|
set_geometry( $left, 0, 1, $w1, $h - 2 );
|
||||||
|
|||||||
@ -275,13 +275,6 @@ my %handlers = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: To util function
|
|
||||||
sub format_number_sep {
|
|
||||||
my ($number) = @_;
|
|
||||||
1 while $number =~ s/^(-?\d+)(\d{3})/$1.$2/;
|
|
||||||
return $number;
|
|
||||||
}
|
|
||||||
|
|
||||||
my @benchs = ( 'ip', 'mem', 'regs' );
|
my @benchs = ( 'ip', 'mem', 'regs' );
|
||||||
my @markers = (
|
my @markers = (
|
||||||
'OK_MARKER', 'FAIL_MARKER',
|
'OK_MARKER', 'FAIL_MARKER',
|
||||||
@ -305,7 +298,7 @@ my %handlers = (
|
|||||||
{
|
{
|
||||||
$entry .= sprintf(
|
$entry .= sprintf(
|
||||||
"%50s ",
|
"%50s ",
|
||||||
format_number_sep(
|
Util::format_number_sep(
|
||||||
$all_results{$experiment}{$benchmark}{$marker}
|
$all_results{$experiment}{$benchmark}{$marker}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user