verilator/test_regress/t/t_verilated_all.pl
Geza Lore b1b5b5dfe2 Improve run-time profiling
The --prof-threads option has been split into two independent options:
1. --prof-exec, for collecting verilator_gantt and other execution
related profiling data, and
2. --prof-pgo, for collecting data needed for PGO

The implementation of execution profiling is extricated from
VlThreadPool and is now a separate class VlExecutionProfiler. This means
--prof-exec can now be used for single-threaded models (though it does
not measure a lot of things just yet). For consistency VerilatedProfiler
is renamed VlPgoProfiler. Both VlExecutionProfiler and VlPgoProfiler are
in verilated_profiler.{h/cpp}, but can be used completely independently.

Also re-worked the execution profile format so it now only emits events
without holding onto any temporaries. This is in preparation for some
future optimizations that would be hindered by the introduction of function
locals via AstText.

Also removed the Barrier event. Clearing the profile buffers is not
notably more expensive as the profiling records are trivially
destructible.
2022-03-27 15:57:30 +02:00

68 lines
2.2 KiB
Perl
Executable File

#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003-2009 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(vlt => 1);
my $root = "..";
compile(
# Can't use --coverage and --savable together, so cheat and compile inline
verilator_flags2 => ["--cc",
"--coverage-toggle --coverage-line --coverage-user",
"--trace --vpi ",
($Self->cfg_with_threaded
? "--threads 2 $root/include/verilated_threads.cpp" : ""),
($Self->cfg_with_threaded
? "--trace-threads 1" : ""),
"--prof-exec", "--prof-pgo",
"$root/include/verilated_save.cpp"],
);
execute(
all_run_flags => [" +verilator+prof+exec+file+/dev/null",
" +verilator+prof+vlt+file+/dev/null",
],
check_finished => 1,
);
my %hit;
foreach my $file (glob("$root/include/*.cpp $root/include/*.h")) {
$file =~ s!.*/!!;
# This file isn't actually used by the runtime (though
# it might be in the future? hence it's under include/)
# It is used to build verilator.
if ($file =~ /verilated_unordered_set_map\.h/) { next; }
print "NEED: $file\n" if $Self->{verbose};
$hit{$file} = 0;
}
foreach my $dfile (glob("$Self->{obj_dir}/*.d")) {
my $wholefile = file_contents($dfile);
foreach my $file (split /\s+/, $wholefile) {
$file =~ s!.*/!!;
print "USED: $file\n" if $Self->{verbose};
$hit{$file} = 1;
}
}
foreach my $file (sort keys %hit) {
if (!$hit{$file}
&& $file !~ /_sc/
&& $file !~ /_fst/
&& $file !~ /_heavy/
&& ($file !~ /_thread/ || $Self->cfg_with_threaded)) {
error("Include file not covered by t_verilated_all test: ", $file);
}
}
ok(1);
1;