请说明你的详细需求,如果只是给一个总体的平均速度,那么只要用文件总体大小除以消耗时间就可以了,不是么?
在开始前计算时间,在结束之后计算时间。 $ perl -le 'print time' 1295405606 ... downloading 50k Bytes $ perl -le 'print time' 1295405607 50KB/1=50K BPS 2011/1/19 Gary.jsz <[email protected]> > 我理解的hash, 只是定义一个类似进度条的处理,并不能打印出实际的传输速度。 > 如果要打印出实际的传输速度,比如: 60kb/s ,还是不能。 > > > > > > > ======= 2011-01-19 09:47 joe jiang 您在来信中写到:Re: [PerlChina] 答复: > Net::FTP如何返回上传下载的速度 ======= > > CONSTRUCTOR > new ([ HOST ] [, OPTIONS ]) > ... > Hash - If given a reference to a file handle (e.g., "\*STDERR"), > print hash marks (#) on that filehandle every > 1024 bytes. This simply invokes the "hash()" method for you, so > that hash marks are displayed for all transfers. > You can, of course, call "hash()" explicitly whenever you'd > like. > > 这个参数可以比较形象化的显明传输速度。具体案例可以参考: > > > http://coding.derkeiler.com/Archive/Perl/perl.beginners/2005-12/msg00186.html > > 2011/1/18 Gary.jsz <[email protected]> > >> 或者有没有其他方法可以用了测试FTP上传下载速度的? >> >> >> >> >> >> ======= 2011-01-17 16:59 [email protected] 您在来信中写到:Net::FTP如何返回上传下载的速度 >> ======= >> >> 大家好! >> >> 今天使用Net::FTP模块来测试FTP,但是没办法打印其下载和上传的速度,请问该怎么做? >> >> 比如使用shell脚本,会返回: >> 3145728 bytes received in 00:50 (60.87 KB/s) >> local: put remote: put >> 229 Entering Extended Passive Mode (|||28677|) >> 150 Ok to send data. >> 226 File receive OK. >> 3145728 bytes sent in 04:02 (12.68 KB/s) >> >> >> >> = = = = = = = = = = = = = = = = = = = = >> >> ------------------------------ >> 深圳市傲冠软件股份有限公司 运营部 蒋士竹 >> ---------------------------------------------------------- >> *Address*: 深圳市福田区深南大道6015号本元大厦16楼 518040 >> *Tel*: (0)13816642255 *MSN*: [email protected] >> *Email*: [email protected] *Website*: www.skybility.com >> >> -- >> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >> 要取消订阅此网上论坛,请发送电子邮件至 >> [email protected]<perlchina%[email protected]> >> 。 >> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 >> > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 要取消订阅此网上论坛,请发送电子邮件至 > [email protected]<perlchina%[email protected]> > 。 > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 > > > = = = = = = = = = = = = = = = = = = = = > > ------------------------------ > 深圳市傲冠软件股份有限公司 运营部 蒋士竹 > ---------------------------------------------------------- > *Address*: 深圳市福田区深南大道6015号本元大厦16楼 518040 > *Tel*: (0)13816642255 *MSN*: [email protected] > *Email*: [email protected] *Website*: www.skybility.com > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 要取消订阅此网上论坛,请发送电子邮件至 > [email protected]<perlchina%[email protected]> > 。 > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 > -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
