X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FUserExtra.pl;h=49124799e2198357b6867449391e81ceab1c12bd;hb=34a4d11667b0a734343f82d2adbaac23f738ad18;hp=7079f6a7b96b4b13d7b6676d8b1e3756090d66c8;hpb=92c3870d1fd6aa5f063a57cfb690aea12ec77df7;p=infobot.git diff --git a/src/UserExtra.pl b/src/UserExtra.pl index 7079f6a..4912479 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -160,6 +160,7 @@ sub chaninfo { $new{$_} = $userstats{$_}{'Count'}; } + # todo: show top 3 with percentages? my($count) = (sort { $a <=> $b } keys %new)[0]; if ($count) { $reply .= ". \002$count\002 has said the most with a total of \002$new{$count}\002 messages"; @@ -693,19 +694,28 @@ sub userCommands { my $raw_perc2 = $cpu_usage2*100/$time; my $perc; my $perc2; + my $total; + my $ratio; if ($raw_perc > 1) { $perc = sprintf("%.01f", $raw_perc); $perc2 = sprintf("%.01f", $raw_perc2); + $total = sprintf("%.01f", $raw_perc+$raw_perc2); } elsif ($raw_perc > 0.1) { $perc = sprintf("%.02f", $raw_perc); $perc2 = sprintf("%.02f", $raw_perc2); + $total = sprintf("%.02f", $raw_perc+$raw_perc2); } else { # <=0.1 $perc = sprintf("%.03f", $raw_perc); $perc2 = sprintf("%.03f", $raw_perc2); + $total = sprintf("%.03f", $raw_perc+$raw_perc2); } + $ratio = sprintf("%.01f", 100*$perc/($perc+$perc2) ); - &pSReply("Total CPU usage: $cpu_usage s ... Percentage CPU used: $perc % (+childs: $perc2 %)"); + &pSReply("Total CPU usage: \002$cpu_usage\002 s ... ". + "Total used: \002$total\002 % ". + "(parent/child ratio: $ratio %)" + ); return; }