1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#!/usr/bin/perl
# Change the above line to read /usr/local/bin/perl if you or your
# vendor puts perl there.
# Summarizes the accounting file (act_file) generated by the qmaster
while (<>) {
($qname,$hostname,$master,$qcomplex_str,$group,$owner,$job_name,$dqs_job_name,$account,$priority,$job_number,$submission_time,$start_time,$end_time,$exit_status,$ru_wallclock,$ru_utime,$ru_stime,$ru_maxrss,$ru_ixrss,$ru_ismrss,$ru_idrss,$ru_isrss,$ru_minflt,$ru_majflt,$ru_nswap,$ru_inblock,$ru_oublock,$ru_msgsnd,$ru_msgrcv,$ru_nsignals,$ru_nvcsw,$ru_nivcsw) = split(':',$_);
$hostname =~ s/\..*//;
$account =~ s/\@.*//;
$cputime = $ru_utime + $ru_stime;
$usage_user{$owner} += $cputime;
$usage_account{$account} += $cputime;
$usage_user_account{$owner}{$account} += $cputime;
$usage_user_account_host{$owner}{$account}{$hostname} += $cputime;
$usage_user_host{$owner}{$hostname} += $cputime;
$usage_host{$hostname} += $cputime;
$total += $cputime;
}
printf("host total");
foreach $user (keys %usage_user) {
printf(" %8s",$user);
}
printf("\n");
printf("---- -----");
foreach $user (keys %usage_user) {
printf(" --------",$user);
}
printf("\n");
foreach $host (keys %usage_host) {
printf("%-8s %8d",$host,$usage_host{$host}/3600);
foreach $user (keys %usage_user) {
printf(" %8d",$usage_user_host{$user}{$host}/3600);
}
printf("\n");
}
printf("---- -----");
foreach $user (keys %usage_user) {
printf(" --------",$user);
}
printf("\n");
printf(" %8d",$total/3600);
foreach $user (keys %usage_user) {
printf(" %8d",$usage_user{$user}/3600);
}
printf("\n\n");
foreach $user (keys %usage_user) {
printf("%-8s %8d\n",$user,$usage_user{$user}/3600);
foreach $account (keys %{$usage_user_account{$user}}) {
printf("%8s %8d\n",$account,$usage_user_account{$user}{$account}/3600);
}
}
|