Как я могу оценить все время процесса записи, включая синхронизацию?

net0— это интерфейс, а net0/addrи net0/v4— это объекты addrobj . У вас может быть несколько addrobj, связанных с одним и тем же сетевым интерфейсом уровня 2 (канала передачи данных ).

Из Администрирование Oracle Solaris :Сетевые интерфейсы и виртуализация сети:

addrobj

Specifies an identifier for the unique IP address or set of addresses that is used in the system. The addresses can be either IPv4 or IPv6 types.

The identifier uses the format: interface / user_specified_string.

The interface refers to the IP interface to which the address is assigned. The interface variable must reflect the name of the datalink on which the IP interface is configured.

user-specified-string refers to a string of alphanumeric characters that begins with an alphabet letter and has a maximum length of 32 characters. Subsequently, you can refer to the addrobj instead of the numeric IP address when you use any ipadm subcommand that manages addresses in the system, such as ipadm show-addr, or ipadm delete-addr.

1
26.11.2019, 19:52
1 ответ

Шеллскрипт

Спасибо @LinuxSecurityFreak за совет использовать количество «грязных» данных, указанное в /proc/meminfo.

Я сделал следующий шелл-скрипт flusher. Он показывает ход выполнения и расчетное время очистки буферов. Его можно использовать, например, после клонирования файла iso на USB-накопитель или карту памяти для создания живого диска с операционной системой Linux.

#!/bin/bash

timeorig=$(date '+%s')
deltat=5  # checking time interval

dirtorig=$(grep -e 'Dirty:' /proc/meminfo | tr -s ' ' '\t' | cut -f2)
dirt0=$dirtorig
echo -n "dirty = $dirt0 kB - before sync"

sync & spid=$!

while ps -A|grep "$spid" > /dev/null
do
 sleep "$deltat"
 dirty=$(grep -e 'Dirty:' /proc/meminfo | tr -s ' ' '\t' | cut -f2)
 deltad=$((dirt0-dirty))
 if [ $deltad -gt 0 ]
 then
  eta="$((dirty*deltat/deltad)) s"
  rate="$(((deltad+500)/deltat/1000)) MB/s"
 else
  eta="n.a."
  rate="n.a."
 fi
 echo -en "\0033[2K\0033[1G"
 echo -n "dirty = $dirty kB -- syncing -- rate = $rate -- eta = $eta"
 dirt0="$dirty"
done
echo -e "\0033[2K\0033[1GDone syncing :-)"

timefinal=$(date '+%s')
timeused=$((timefinal-timeorig))
if [ $timeused -gt 0 ]
then
 rate="$(((10*dirtorig+5)/timeused/10))"
 if [ $rate -ge 10000 ]
 then
  rate="$(((dirtorig+500)/timeused/1000)) MB/s"
 else
  rate="$rate kB/S"
 fi
else
 rate="n.a."
fi
echo "syncing time = $timeused s -- rate = $rate"

Демонстрационные примеры

Клонирование на медленный диск (USB 2)

$ sudo dd if=xubuntu-18.04.1-desktop-amd64.iso of=/dev/sde bs=1M ;./flusher
[sudo] password for sudodus: 
1367+1 posts in
1367+1 posts ut
1434386432 bytes (1.4 GB, 1.3 GiB) copied, 0.408724 s, 3.5 GB/s

Выход изflusher:

dirty = 840600 kB -- syncing -- rate = 5 MB/s -- eta = 156 s
...
Done syncing :-)
syncing time = 302 s -- rate = 4639 kB/S

Клонирование на быстрый диск (eSATA)

$ sudo dd if=xubuntu-18.04.1-desktop-amd64.iso of=/dev/sda bs=1M ;./flusher
1367+1 posts in
1367+1 posts ut
1434386432 bytes (1.4 GB, 1.3 GiB) copied, 0.404442 s, 3.5 GB/s

Выход изflusher:

dirty = 727508 kB -- syncing -- rate = 59 MB/s -- eta = 12 s
...
Done syncing :-)
syncing time = 25 s -- rate = 56 MB/s
2
27.01.2020, 23:29

Теги

Похожие вопросы