verilator_gantt: Fix reading broken /cpu/procinfo reports

This commit is contained in:
Wilson Snyder 2021-10-02 11:10:43 -04:00
parent f5c9deecb8
commit 2560fc867f
4 changed files with 120 additions and 8 deletions

View File

@ -271,16 +271,18 @@ def report_cpus():
socket = None
if cpu in Global['cpuinfo']:
socket = int(Global['cpuinfo'][cpu]['physical_id'])
Global['cpu_sockets'][socket] += 1
print(" socket=%d" % socket, end='')
cpuinfo = Global['cpuinfo'][cpu]
if 'physical_id' in cpuinfo and 'core_id' in cpuinfo:
socket = int(cpuinfo['physical_id'])
Global['cpu_sockets'][socket] += 1
print(" socket=%d" % socket, end='')
core = int(Global['cpuinfo'][cpu]['core_id'])
Global['cpu_socket_cores'][str(socket) + "__" + str(core)] += 1
print(" core=%d" % core, end='')
core = int(cpuinfo['core_id'])
Global['cpu_socket_cores'][str(socket) + "__" + str(core)] += 1
print(" core=%d" % core, end='')
model = Global['cpuinfo'][cpu]['model_name']
if model:
if 'model_name' in cpuinfo:
model = cpuinfo['model_name']
print(" %s" % model, end='')
print()

View File

@ -0,0 +1,53 @@
VLPROFTHREAD 1.1 # Verilator thread profile dump version 1.1
VLPROF arg --threads 4
VLPROF arg +verilator+prof+threads+start+1
VLPROF arg +verilator+prof+threads+window+2
VLPROF stat yields 51
VLPROFPROC processor : 0
VLPROFPROC model name : Phytium,FT-2500/128
VLPROFPROC BogoMIPS : 100.00
VLPROFPROC Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
VLPROFPROC CPU implementer : 0x70
VLPROFPROC CPU architecture: 8
VLPROFPROC CPU variant : 0x1
VLPROFPROC CPU part : 0x663
VLPROFPROC CPU revision : 3
VLPROFPROC
VLPROFPROC processor : 1
VLPROFPROC model name : Phytium,FT-2500/128
VLPROFPROC BogoMIPS : 100.00
VLPROFPROC Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
VLPROFPROC CPU implementer : 0x70
VLPROFPROC CPU architecture: 8
VLPROFPROC CPU variant : 0x1
VLPROFPROC CPU part : 0x663
VLPROFPROC CPU revision : 3
VLPROFPROC
VLPROFPROC processor : 2
VLPROFPROC model name : Phytium,FT-2500/128
VLPROFPROC BogoMIPS : 100.00
VLPROFPROC Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
VLPROFPROC CPU implementer : 0x70
VLPROFPROC CPU architecture: 8
VLPROFPROC CPU variant : 0x1
VLPROFPROC CPU part : 0x663
VLPROFPROC CPU revision : 3
VLPROFPROC
VLPROFPROC processor : 3
VLPROFPROC model name : Phytium,FT-2500/128
VLPROFPROC BogoMIPS : 100.00
VLPROFPROC Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
VLPROFPROC CPU implementer : 0x70
VLPROFPROC CPU architecture: 8
VLPROFPROC CPU variant : 0x1
VLPROFPROC CPU part : 0x663
VLPROFPROC CPU revision : 3
VLPROFPROC
VLPROF eval start 57709 elapsed 1745979 cpu 2 on thread 1
VLPROF eval_loop start 58532 elapsed 1744353 cpu 2 on thread 1
VLPROF mtask 85 start 90465 elapsed 64569 predict_start 14315 predict_cost 30533 cpu 2 on thread 1
VLPROF mtask 79 start 156555 elapsed 137754 predict_start 44848 predict_cost 48001 cpu 2 on thread 1
VLPROF mtask 90 start 77352 elapsed 1159 predict_start 14315 predict_cost 21592 cpu 3 on thread 2
VLPROF mtask 81 start 79799 elapsed 868 predict_start 35907 predict_cost 29215 cpu 3 on thread 2
VLPROF mtask 87 start 81746 elapsed 887 predict_start 65147 predict_cost 33809 cpu 3 on thread 2
VLPROF stat ticks 180832

View File

@ -0,0 +1,37 @@
Verilator Gantt report
Argument settings:
+verilator+prof+threads+start+1
+verilator+prof+threads+window+2
--threads 4
Analysis:
Total threads = 2
Total mtasks = 5
Total cpus used = 2
Total yields = 51
Total evals = 1
Total eval loops = 1
Total eval time = 294309 rdtsc ticks
Longest mtask time = 137754 rdtsc ticks
All-thread mtask time = 205237 rdtsc ticks
Longest-thread efficiency = 46.8%
All-thread efficiency = 34.9%
All-thread speedup = 0.7
Prediction (what Verilator used for scheduling):
All-thread efficiency = 82.4%
All-thread speedup = 1.6
Statistics:
min log(p2e) = -1.054 from mtask 79 (predict 48001, elapsed 137754)
max log(p2e) = 3.641 from mtask 87 (predict 33809, elapsed 887)
mean = 1.656
stddev = 2.104
e ^ stddev = 8.200
CPUs:
cpu 2: cpu_time=202323 Phytium,FT-2500/128
cpu 3: cpu_time=2914 Phytium,FT-2500/128
Writing profile_threads.vcd

View File

@ -0,0 +1,20 @@
#!/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
scenarios(dist => 1);
run(cmd => ["cd $Self->{obj_dir} && $ENV{VERILATOR_ROOT}/bin/verilator_gantt"
. " $Self->{t_dir}/$Self->{name}.dat > gantt.log"],
check_finished => 0);
files_identical("$Self->{obj_dir}/gantt.log", $Self->{golden_filename});
ok(1);
1;