Skip to content

Commit 15c009e

Browse files
[generate_dump] Optimize the execution time of 'show techsupport' CLI by parallel function execution
Signed-off-by: Vadym Hlushko <[email protected]>
1 parent 40cc8e1 commit 15c009e

1 file changed

Lines changed: 89 additions & 69 deletions

File tree

scripts/generate_dump

Lines changed: 89 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,103 +1464,121 @@ main() {
14641464
/proc/pagetypeinfo /proc/partitions /proc/sched_debug /proc/slabinfo \
14651465
/proc/softirqs /proc/stat /proc/swaps /proc/sysvipc /proc/timer_list \
14661466
/proc/uptime /proc/version /proc/vmallocinfo /proc/vmstat \
1467-
/proc/zoneinfo \
1468-
|| abort "${EXT_PROCFS_SAVE_FAILED}" "Proc saving operation failed. Aborting for safety."
1469-
save_proc_stats
1467+
/proc/zoneinfo &
1468+
save_proc_stats &
14701469
end_t=$(date +%s%3N)
14711470
echo "[ Capture Proc State ] : $(($end_t-$start_t)) msec" >> $TECHSUPPORT_TIME_INFO
1471+
wait
14721472

14731473
# Save all the processes within each docker
1474-
save_cmd "show services" services.summary
1474+
save_cmd "show services" services.summary &
14751475

14761476
# Save reboot cause information
1477-
save_cmd "show reboot-cause" reboot.cause
1477+
save_cmd "show reboot-cause" reboot.cause &
1478+
wait
14781479

14791480
local asic="$(/usr/local/bin/sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)"
14801481
# 1st counter snapshot early. Need 2 snapshots to make sense of counters trend.
14811482
save_counter_snapshot $asic 1
14821483

1483-
save_cmd "systemd-analyze blame" "systemd.analyze.blame"
1484-
save_cmd "systemd-analyze dump" "systemd.analyze.dump"
1485-
save_cmd "systemd-analyze plot" "systemd.analyze.plot.svg"
1486-
1487-
save_platform_info
1488-
1489-
save_cmd "show vlan brief" "vlan.summary"
1490-
save_cmd "show version" "version"
1491-
save_cmd "show platform summary" "platform.summary"
1492-
save_cmd "cat /host/machine.conf" "machine.conf"
1493-
save_cmd "cat /boot/config-$(uname -r)" "boot.conf"
1494-
save_cmd "docker stats --no-stream" "docker.stats"
1495-
1496-
save_cmd "sensors" "sensors"
1497-
save_cmd "lspci -vvv -xx" "lspci"
1498-
save_cmd "lsusb -v" "lsusb"
1499-
save_cmd "sysctl -a" "sysctl"
1500-
1501-
save_ip_info
1502-
save_bridge_info
1503-
1504-
save_frr_info
1505-
save_bgp_info
1506-
save_evpn_info
1507-
1508-
save_cmd "show interface status -d all" "interface.status"
1509-
save_cmd "show interface transceiver presence" "interface.xcvrs.presence"
1510-
save_cmd "show interface transceiver eeprom --dom" "interface.xcvrs.eeprom"
1511-
save_cmd "show ip interface -d all" "ip.interface"
1512-
1513-
save_cmd "lldpctl" "lldpctl"
1484+
save_cmd "systemd-analyze blame" "systemd.analyze.blame" &
1485+
save_cmd "systemd-analyze dump" "systemd.analyze.dump" &
1486+
save_cmd "systemd-analyze plot" "systemd.analyze.plot.svg" &
1487+
wait
1488+
1489+
save_platform_info &
1490+
save_cmd "show vlan brief" "vlan.summary" &
1491+
save_cmd "show version" "version" &
1492+
save_cmd "show platform summary" "platform.summary" &
1493+
wait
1494+
1495+
save_cmd "cat /host/machine.conf" "machine.conf" &
1496+
save_cmd "cat /boot/config-$(uname -r)" "boot.conf" &
1497+
save_cmd "docker stats --no-stream" "docker.stats" &
1498+
wait
1499+
1500+
save_cmd "sensors" "sensors" &
1501+
save_cmd "lspci -vvv -xx" "lspci" &
1502+
save_cmd "lsusb -v" "lsusb" &
1503+
save_cmd "sysctl -a" "sysctl" &
1504+
wait
1505+
1506+
save_ip_info &
1507+
save_bridge_info &
1508+
wait
1509+
1510+
save_frr_info &
1511+
1512+
save_bgp_info &
1513+
save_evpn_info &
1514+
wait
1515+
1516+
save_cmd "show interface status -d all" "interface.status" &
1517+
save_cmd "show interface transceiver presence" "interface.xcvrs.presence" &
1518+
save_cmd "show interface transceiver eeprom --dom" "interface.xcvrs.eeprom" &
1519+
save_cmd "show ip interface -d all" "ip.interface" &
1520+
wait
1521+
1522+
save_cmd "lldpctl" "lldpctl" &
15141523
if [[ ( "$NUM_ASICS" > 1 ) ]]; then
15151524
for (( i=0; i<$NUM_ASICS; i++ ))
15161525
do
1517-
save_cmd "docker exec lldp$i lldpcli show statistics" "lldp$i.statistics"
1518-
save_cmd "docker logs bgp$i" "docker.bgp$i.log"
1519-
save_cmd "docker logs swss$i" "docker.swss$i.log"
1526+
save_cmd "docker exec lldp$i lldpcli show statistics" "lldp$i.statistics" &
1527+
save_cmd "docker logs bgp$i" "docker.bgp$i.log" &
1528+
save_cmd "docker logs swss$i" "docker.swss$i.log" &
15201529
done
15211530
else
1522-
save_cmd "docker exec lldp lldpcli show statistics" "lldp.statistics"
1523-
save_cmd "docker logs bgp" "docker.bgp.log"
1524-
save_cmd "docker logs swss" "docker.swss.log"
1531+
save_cmd "docker exec lldp lldpcli show statistics" "lldp.statistics" &
1532+
save_cmd "docker logs bgp" "docker.bgp.log" &
1533+
save_cmd "docker logs swss" "docker.swss.log" &
15251534
fi
1526-
1527-
save_cmd "ps aux" "ps.aux"
1528-
save_cmd "top -b -n 1" "top"
1529-
save_cmd "free" "free"
1530-
save_cmd "vmstat 1 5" "vmstat"
1531-
save_cmd "vmstat -m" "vmstat.m"
1532-
save_cmd "vmstat -s" "vmstat.s"
1533-
save_cmd "mount" "mount"
1534-
save_cmd "df" "df"
1535-
save_cmd "dmesg" "dmesg"
1536-
1537-
save_nat_info
1538-
save_bfd_info
1539-
save_redis_info
1535+
wait
1536+
1537+
save_cmd "ps aux" "ps.aux" &
1538+
save_cmd "top -b -n 1" "top" &
1539+
save_cmd "free" "free" &
1540+
wait
1541+
save_cmd "vmstat 1 5" "vmstat" &
1542+
save_cmd "vmstat -m" "vmstat.m" &
1543+
save_cmd "vmstat -s" "vmstat.s" &
1544+
wait
1545+
save_cmd "mount" "mount" &
1546+
save_cmd "df" "df" &
1547+
save_cmd "dmesg" "dmesg" &
1548+
wait
1549+
1550+
save_nat_info &
1551+
save_bfd_info &
1552+
wait
1553+
save_redis_info &
15401554

15411555
if $DEBUG_DUMP
15421556
then
1543-
save_dump_state_all_ns
1557+
save_dump_state_all_ns &
15441558
fi
1559+
wait
15451560

1546-
save_cmd "docker ps -a" "docker.ps"
1547-
save_cmd "docker top pmon" "docker.pmon"
1561+
save_cmd "docker ps -a" "docker.ps" &
1562+
save_cmd "docker top pmon" "docker.pmon" &
15481563

15491564
if [[ -d ${PLUGINS_DIR} ]]; then
15501565
local -r dump_plugins="$(find ${PLUGINS_DIR} -type f -executable)"
15511566
for plugin in $dump_plugins; do
15521567
# save stdout output of plugin and gzip it
1553-
save_cmd "$plugin" "$(basename $plugin)" true
1568+
save_cmd "$plugin" "$(basename $plugin)" true &
15541569
done
15551570
fi
1571+
wait
15561572

1557-
save_cmd "dpkg -l" "dpkg"
1558-
save_cmd "who -a" "who"
1559-
save_cmd "swapon -s" "swapon"
1560-
save_cmd "hdparm -i /dev/sda" "hdparm"
1561-
save_cmd "ps -AwwL -o user,pid,lwp,ppid,nlwp,pcpu,pri,nice,vsize,rss,tty,stat,wchan:12,start,bsdtime,command" "ps.extended"
1573+
save_cmd "dpkg -l" "dpkg" &
1574+
save_cmd "who -a" "who" &
1575+
save_cmd "swapon -s" "swapon" &
1576+
wait
1577+
save_cmd "hdparm -i /dev/sda" "hdparm" &
1578+
save_cmd "ps -AwwL -o user,pid,lwp,ppid,nlwp,pcpu,pri,nice,vsize,rss,tty,stat,wchan:12,start,bsdtime,command" "ps.extended" &
15621579

1563-
save_saidump
1580+
save_saidump &
1581+
wait
15641582

15651583
if [ "$asic" = "barefoot" ]; then
15661584
collect_barefoot
@@ -1584,6 +1602,7 @@ main() {
15841602
$RM $V -rf $TARDIR
15851603
$MKDIR $V -p $TARDIR
15861604
$MKDIR $V -p $LOGDIR
1605+
15871606
# Copying the /etc files to a directory and then tar it
15881607
$CP -r /etc $TARDIR/etc
15891608
rm_list=$(find -L $TARDIR/etc -maxdepth 5 -type l)
@@ -1620,9 +1639,10 @@ main() {
16201639
end_t=$(date +%s%3N)
16211640
echo "[ TAR /etc Files ] : $(($end_t-$start_t)) msec" >> $TECHSUPPORT_TIME_INFO
16221641

1623-
save_log_files
1624-
save_crash_files
1625-
save_warmboot_files
1642+
save_log_files &
1643+
save_crash_files &
1644+
save_warmboot_files &
1645+
wait
16261646

16271647
finalize
16281648
}

0 commit comments

Comments
 (0)