From fd4595d6b48250e8f8e9f2f59598c28011f6d2e7 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 24 Sep 2021 08:25:40 -0400 Subject: [PATCH] verilator_gantt: Add eval count to report --- bin/verilator_gantt | 2 ++ test_regress/t/t_gantt.pl | 29 +++-------------------------- test_regress/t/t_gantt_io.out | 2 ++ 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/bin/verilator_gantt b/bin/verilator_gantt index 1a43cf6a7..66e433f88 100755 --- a/bin/verilator_gantt +++ b/bin/verilator_gantt @@ -174,6 +174,8 @@ def report(): ncpus = len(Global['cpus']) print(" Total cpus used = %d" % ncpus) print(" Total yields = %d" % int(Global['stats']['yields'])) + print(" Total evals = %d" % len(Evals)) + print(" Total eval loops = %d" % len(EvalLoops)) print(" Total eval time = %d rdtsc ticks" % Global['measured_last_end']) print(" Longest mtask time = %d rdtsc ticks" % long_mtask_time) diff --git a/test_regress/t/t_gantt.pl b/test_regress/t/t_gantt.pl index 77b8714a4..ffaf7eba6 100755 --- a/test_regress/t/t_gantt.pl +++ b/test_regress/t/t_gantt.pl @@ -44,32 +44,9 @@ run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_gantt", verilator_run => 1, ); -# We should have three lines of gantt chart, each with -# an even number of mtask-bars (eg "[123--]") -my $gantt_line_ct = 0; -my $global_mtask_ct = 0; -{ - my $fh = IO::File->new("<$Self->{obj_dir}/gantt.log") - or error("$! $Self->{obj_dir}/gantt.log"); - while (my $line = ($fh && $fh->getline)) { - if ($line !~ m/^ t:/) { next; } - $gantt_line_ct++; - my $this_thread_mtask_ct = 0; - my @mtasks = split(/\[/, $line); - shift @mtasks; # throw the '>> ' away - foreach my $mtask (@mtasks) { - # Format of each mtask is "[123--]" where the hyphens - # number or ] may or may not appear; it depends on exact timing. - $this_thread_mtask_ct++; - $global_mtask_ct++; - } - if ($this_thread_mtask_ct % 2 != 0) { error("odd number of mtasks found"); } - } -} -if ($gantt_line_ct != 2) { error("wrong number of gantt lines"); } -if ($global_mtask_ct == 0) { error("wrong number of mtasks, should be > 0"); } -print "Found $gantt_line_ct lines of gantt data with $global_mtask_ct mtasks\n" - if $Self->{verbose}; +file_grep("$Self->{obj_dir}/gantt.log", qr/Total threads += 2/i); +file_grep("$Self->{obj_dir}/gantt.log", qr/Total mtasks += 7/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_threads.vcd", "$Self->{obj_dir}/profile_threads.vcd"); diff --git a/test_regress/t/t_gantt_io.out b/test_regress/t/t_gantt_io.out index 45e0ba447..121244069 100644 --- a/test_regress/t/t_gantt_io.out +++ b/test_regress/t/t_gantt_io.out @@ -17,6 +17,8 @@ Analysis: Total mtasks = 7 Total cpus used = 2 Total yields = 0 + Total evals = 2 + Total eval loops = 2 Total eval time = 21875 rdtsc ticks Longest mtask time = 1190 rdtsc ticks All-thread mtask time = 5495 rdtsc ticks