wishartz has asked for the wisdom of the Perl Monks concerning the following question:
Any help would be fantastic. I've hit a brick wall with it.sub reportg{ my( $userjobcount_ref, $userjobcpu_ref, $queuejobsystem_ref, $userjobt +ime_ref, $queue_cpu_summary_ref, $total_ref, $count) = @_; my( $total, $avg, $month_or_day,$user, $queue, $system_cpu); $MW = MainWindow->new; foreach $month_or_day (sort keys %{$queue_cpu_summary_ref}) { $total_user_job_count=0; foreach $queue (sort keys %{$queue_cpu_summary_ref->{$ +month_or_day}}) { $total += $$queue_cpu_summary_ref{$month_or_da +y}{$queue}; } } foreach $month_or_day (sort keys %{$queue_cpu_summary_ref}) { foreach $queue (sort keys %{$queue_cpu_summary_ref->{$ +month_or_day}}) { printf ("%-2s",$month_or_day); printf("%-10s","\t$queue"); $usage=sprintf ("%.3f", $$queue_cpu_su +mmary_ref{$month_or_day}{$queue} / $total * 100); print "\t$usage%"; print "\n"; $$data{$queue} = $usage; } } print $total; $ca = $MW->Graph( -type => $typ, -borderwidth => 2, -title => $field, -titlecolor => 'Brown', -yformat => '%2.2f', -ylabel => 'percentage', -xlabel => 'queue', -barwidth => 15, -padding => [20,20,20,100], # Padding [top, right, + buttom, left] -linewidth => 1, -shadow => 'gray50', -shadowdepth => 3, -maxmin => 1, -look => 50, -balloon => 1, -legend => 1, )->pack(-expand => 1, -fill => 'both'); $ca->configure(-variable => $data); # bind to data &menu($MW, $ca); MainLoop; } # Subs ---------------------------------- sub set3d { my $val = shift || 0; $ca->configure(-threed => $val); $ca->clear; } sub setdisplay { $typ = shift; $ca->clear; print "$typ\n"; $ca->configure(-type => $typ); } sub menu { my $top = shift || die; my $ca = shift || die; my $menuitems = [ [Cascade => "File", -menuitems => [ [Button => "Quit", -command => \&quitapp], ] ], [Cascade => "View", -menuitems => [ [Radiobutton => "~Bars", -variable => \$typ, -command +=> [\&setdisplay, 'Bars'] ], [Radiobutton => "~HBars", -variable => \$typ, -command +=> [\&setdisplay, 'Hbars']], [Radiobutton => "~Circle", -variable => \$typ, -command + => [\&setdisplay, 'Circle']], [Radiobutton => "~Line", -variable => \$typ, -command = +> [\&setdisplay, 'Line']], [Cascade => "~3d", -menuitems => [ [Button => "Off", -command => [\&set3d, 0] ], [Button => "3", -command => [\&set3d, 3] ], [Button => "5", -command => [\&set3d, 5] ], [Button => "7", -command => [\&set3d, 7] ], [Button => "10", -command => [\&set3d, 10] ], ] ], ] ], ]; if ($Tk::VERSION >= 800) { my $menubar = $top->Menu(-menuitems => $menuitems); $top->configure(-menu => $menubar); } else { $top->Menubutton(-text => "Pseudo menubar", -menuitems => $menuitems)->pack; } } sub quitapp { exit; }
|
|---|