需求 : 接口的访问次数,相应平均时间,稳定性
想想 : 接口 次数和平均时间 好解决 ,稳定性 使用 方差 吧
$> cpan install Statistics::Descriptive
cat /home/co_peacock/tomcat/logs/catalina.out | perl -nle '
$h{$1}{$3}=$2 if /am=(.*?)<.*art=(.*?)<.*at=(.*?)</; END{ use Statistics::Descriptive;
printf "%30s\t%10s\t%10s %10s\n","方法名称","平均耗时","访问次数","标准差"; foreach my $am (keys %h ){ my $stat = Statistics::Descriptive::Full->new(); $stat->add_data( values %{ $h{$am} } ); my $nu = scalar keys %{ $h{$am} } ; my $var = $stat->variance(); my $mean = $stat->mean() ;
printf "%30s %10g %10g %10g\n", $am ,$mean ,$nu, sqrt($var); } }
'
|
结果 :
方法名称 平均耗时 访问次数 标准差
user setLogo 61.5 18 29.0096
search 9107.79 317 30127.1
getPhotoList 7.53125 608 8.72756
searchuser 116.515 194 127.038
addCheckIn 168.25 8 29.2318
getProduct 4.32759 58 2.10586
addPhoto 93.0796 113 62.3281
delProduct 9 2 1.41421
getProductListForClient 14.9022 92 37.8975
getUnreadMessageCount 48.6752 3614 2604.56
delPhoto 87.7258 62 165.845
addProduct 15.6667 3 5.50757
getProductList 10.8384 198 24.1763
updateProduct 7 15 5.19615
sendMessage 78.2329 219 53.085
updatePhoto 21 1 0
settings 116.288 104 93.2433
getCategoryList 3.20225 445 5.90308
getReviewsList 156.19 1382 181.539
getUserProfile 409.12 1303 1031.14
addReview 61.3889 72 145.937
阅读(577) | 评论(0) | 转发(0) |