forked from github/verilator
b1b5b5dfe2
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.
58 lines
2.1 KiB
Perl
Executable File
58 lines
2.1 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 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
|
|
|
|
# Test for bin/verilator_gantt,
|
|
|
|
scenarios(vlt_all => 1);
|
|
|
|
# It doesn't really matter what test
|
|
# we use, so long as it runs several cycles,
|
|
# enough for the profiling to happen:
|
|
top_filename("t/t_gen_alw.v");
|
|
|
|
compile(
|
|
# Checks below care about thread count, so use 2 (minimum reasonable)
|
|
v_flags2 => ["--prof-exec", ($Self->{vltmt} ? "--threads 2" : "")]
|
|
);
|
|
|
|
execute(
|
|
all_run_flags => ["+verilator+prof+exec+start+2",
|
|
" +verilator+prof+exec+window+2",
|
|
" +verilator+prof+exec+file+$Self->{obj_dir}/profile_exec.dat",
|
|
" +verilator+prof+vlt+file+$Self->{obj_dir}/profile.vlt",
|
|
],
|
|
check_finished => 1,
|
|
);
|
|
|
|
# For now, verilator_gantt still reads from STDIN
|
|
# (probably it should take a file, gantt.dat like verilator_profcfunc)
|
|
# The profiling data still goes direct to the runtime's STDOUT
|
|
# (maybe that should go to a separate file - gantt.dat?)
|
|
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_gantt",
|
|
"$Self->{obj_dir}/profile_exec.dat",
|
|
"--vcd $Self->{obj_dir}/profile_exec.vcd",
|
|
"| tee $Self->{obj_dir}/gantt.log"],
|
|
);
|
|
|
|
if ($Self->{vltmt}) {
|
|
file_grep("$Self->{obj_dir}/gantt.log", qr/Total threads += 2/i);
|
|
file_grep("$Self->{obj_dir}/gantt.log", qr/Total mtasks += 7/i);
|
|
} else {
|
|
file_grep("$Self->{obj_dir}/gantt.log", qr/Total threads += 1/i);
|
|
file_grep("$Self->{obj_dir}/gantt.log", qr/Total mtasks += 0/i);
|
|
}
|
|
file_grep("$Self->{obj_dir}/gantt.log", qr/Total evals += 2/i);
|
|
|
|
# Diff to itself, just to check parsing
|
|
vcd_identical("$Self->{obj_dir}/profile_exec.vcd", "$Self->{obj_dir}/profile_exec.vcd");
|
|
|
|
ok(1);
|
|
1;
|