可以通过内建函数len查看channel中元素的个数. 内建函数len的定义如下: func len(v Type) int The len built-in function returns the length of v, according to its type: Array: the number of elements in v.数组中元素的个数 Pointer to array: the number of elements in *v (even if v is nil).数组中
Linux 中查看网口流量的利器 -- sar 有这么一个小工具,通过它能够查看各个网口的IP报文流量统计. 利用sar命令,加上-n DEV参数,即可统计出所有网卡上的流量,在显示的第五和第六列,显示的是接收到的数据流量和发送的数据流量,单位是kB/s,即每秒多少千字节.后面的1 2是指每1秒报告一次,共报告2次. # sar -n DEV 1 2Linux 2.6.32.59-0.7-default (vmCIE) 04/02/14 _x86_64_ 21:12:47