Hi Matty, We use some scripts to post-process busstat into what you are looking for: bandwidth per sbus and device. It's a two phase operation now, collect and report. See below for the report and collect scripts...
Regards, Richard. On Wed, Nov 02, 2005 at 01:48:49PM -0500, Matty wrote: > > Howdy, > > I have been playing around with busstat, and must say that this is a > really really cool utility! To get an idea of what the event counters > mean, I started reading through a PCI reference and the following website: > > http://www.readol.net/books/computer/system/System.Performance.Tuning.Second.Edition/059600284x/spt2-CHP-3-SECT-6.html > > This website mentions that the value "dvma_bytes_xfr" could be used to get > the number of bytes transferred on SBUS-based machines. Upon inspecting > the busstat events on a Sun 280R, I didn't notice a similar event: > > $ busstat -e pcis0 > pic0 > dvma_stream_rd > dvma_stream_wr > dvma_const_rd > dvma_const_wr > dvma_stream_buf_mis > dvma_cycles > dvma_wd_xfr > pio_cycles > dvma_tlb_misses > interrupts > saf_inter_nack > pio_reads > pio_writes > dvma_rd_buf_timeout > dvma_rd_rtry_stc > dvma_wr_rtry_stc > dvma_rd_rtry_nonstc > dvma_wr_rtry_nonstc > E*_slow_transitions > E*_slow_cycles_per_64 > > Are the events documented anywhere by any chance? Is there anything > equivalent to "dvma_bytes_xfr" to get the number of bytes transmitted > on a PCI bus? > > Thanks for any insight, > - Ryan > > -- > UNIX Administrator > http://daemons.net/~matty > _______________________________________________ > perf-discuss mailing list > perf-discuss@opensolaris.org -- :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: Richard Mc Dougall : [EMAIL PROTECTED] Performance and Availability : x31542 Engineering : http://blogs.sun.com/rmc Sun Microsystems Inc : +1 650 352 6438 :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:
busstat.sh
Description: Bourne shell script
#!/usr/bin/perl # Tunables $debug = 0; $CpuExp = 5; $SysioExp = 5; $AcExp = 4; $SSMNodes = 4; $MC_CAP = 8.33; $MC_BDCAP = 11.9; # Get options while ($#ARGV > -1) { $arg = shift @ARGV; if ( $arg =~ /^-(.)(.*)$/ ) { $flag=$1; $val=$2; $flag2=$flag.$val; if ( $flag eq "i" ) { if ( $val eq "" ) { $val = shift @ARGV;} if ( $val eq "" ) { &usage();} $infile = $val; } elsif ($flag eq "o") { if ( $val eq "" ) { $val = shift @ARGV;} if ( $val eq "" ) { &usage();} $outfile = $val; } elsif ($flag eq "v") { if ( $val ne "") { &usage();} $verbose = 1; } elsif ($flag2 eq "ac") { $aconly = 1; } elsif ($flag2 eq "sysio") { $sysioonly = 1; } elsif ($flag2 eq "cpu") { $cpuonly = 1; } elsif ($flag2 eq "uk") { $ukonly = 1; } elsif ($flag2 eq "wfi") { $wfionly = 1; } elsif ($flag2 eq "avg") { $avgonly = 1; } elsif ($flag2 eq "eavg") { $eavgonly = 1; } else { &usage(); } } elsif ( $arg =~ /^(.*)$/ ) { $infile = $1; } } # if no flags are set or if verbose flag is set then set all flags. if ( !($aconly || $sysioonly || $cpuonly || $wfionly || $avgonly || $eavgonly) || $verbose ) { $aconly = $sysioonly = $cpuonly = $wfionly =$avgonly = $eavgonly = 1; } if (defined $infile) { open(STDIN, "<$infile") || die "Could not open $infile\n"; } if (defined $outfile) { open(STDOUT, ">$outfile") || die "Could not open $outfile\n"; } $word = "[a-zA-Z0-9_-]+"; $smallword = "[a-zA-Z]+"; $num = "[0-9]+"; $dec = "[0-9]+\.[0-9]+|[0-9]+|\.[0-9]+|[0-9]+\."; $time = 0; if ($debug) { print " Assumptions: The counts are in millions and not mill/sec or percents Process ID in the output ignored. ", 2 ** $CpuExp," processors per SSM node. ", 2 ** $SysioExp," I/O boards per SSM node. ", 2 ** $AcExp," address controllers per SSM node. "; print "X" x 80,"\n"; print "The following lines in the input were ignored\n"; print "X" x 80,"\n"; } while ($line = <STDIN>) { chop $line; if ( $line =~ /^T\s*=\s*($dec)\s*P\s*=\s*$num\s*($word)\s+I\s*=\s*($num)\s*($word)\s+($dec)\s*($word)\s+($dec)\s*$/ ) { $time = $1; $ctr_set = $2; $part_num = $3; $ctr_a = $4; $cnt_a = $5; $ctr_b = $6; $cnt_b = $7; $hash_a = join(",", ($ctr_set, $part_num, $ctr_a)); $hash_b = join(",", ($ctr_set, $part_num, $ctr_b)); $time{$hash_a} = $1; $count{$hash_a} += $cnt_a; $time{$hash_b} = $1; $count{$hash_b} += $cnt_b; # ++++++++++++++changed by ZYF(for busstat), and I also changed all the cpu events name accordingly # for hstat V8 output lines } elsif ( $line =~ /^($num)\s*($smallword)($num)\s*($word)\s*($num)\s*($word)\s*($num)\s*$/ ){ if ( $time == 0 ) { $time = $1;} $ctr_set = $2; $instance = $3; $ctr_a = $4; $cnt_a = ($5/1000000); @list=split(/-/,$6); $ctr_b = $list[0]; $mode=$list[1]; if ($mode eq "") {$mode = "NA";} $cnt_b = ($7/1000000); $hash_a = join(",", ($2, $3,$mode, $ctr_a)); $hash_b = join(",", ($2, $3,$mode, $ctr_b)); $time{$hash_a} += $time; $count{$hash_a} += $cnt_a; $time{$hash_b} += $time; $count{$hash_b} += $cnt_b; # ++++++++++++++changed by ZYF(busstat) } elsif ($line =~ /^($word) ($num) ($word) ($dec)$/) { $time = 1.0; $ctr_set = $1; $part_num = $2; $ctr = $3; $cnt = $4; $hash = join(",", ($ctr_set, $part_num, $ctr)); $time{$hash} = $time; $count{$hash} = $cnt; } elsif ($debug) { print $line,"\n"; } } if ($debug) { print "X" x 80,"\n";} foreach $ind (keys %time) { ($ctr_set, $part_num, $mode, $ctr) = split(",",$ind); $persec{$ind} = $count{$ind}/$time{$ind}; # take this out for V8 # if ($ctr_set eq "SPITFIRE" || $ctr_set eq "CPU") { # $cpu_total{$ctr} += $persec{$ind}; # $cpu_total_count{$ctr} += 1; # $node = $part_num >> $CpuExp; # $cpu_pernode{$node.",".$ctr} += $persec{$ind}; # $cpu_pernode_count{$node.",".$ctr} += 1; # } if ($ctr_set eq "cpu" && $mode eq "uk") { $cpu_total{$ctr} += $persec{$ind}; $cpu_total_count{$ctr} += 1; $node = $part_num >> $CpuExp; $cpu_pernode{$node.",".$ctr} += $persec{$ind}; $cpu_pernode_count{$node.",".$ctr} += 1; } if ($ctr_set eq "cpu" && $mode eq "u") { $user_cpu_total{$ctr} += $persec{$ind}; $user_cpu_total_count{$ctr} += 1; $node = $part_num >> $CpuExp; $user_cpu_pernode{$node.",".$ctr} += $persec{$ind}; $user_cpu_pernode_count{$node.",".$ctr} += 1; } if ($ctr_set eq "cpu" && $mode eq "k") { $kernel_cpu_total{$ctr} += $persec{$ind}; $kernel_cpu_total_count{$ctr} += 1; $node = $part_num >> $CpuExp; $kernel_cpu_pernode{$node.",".$ctr} += $persec{$ind}; $kernel_cpu_pernode_count{$node.",".$ctr} += 1; } if ($ctr_set eq "WFI") { $wfi_total{$ctr} += $persec{$ind}; $wfi_total_count{$ctr} += 1; } if ($ctr_set eq "SYSIO" || $ctr_set eq "sbus") { $sysio_total{$ctr} += $persec{$ind}; $sysio_total_count{$ctr} += 1; $node = $part_num >> $SysioExp; $sysio_pernode{$node.",".$ctr} += $persec{$ind}; $sysio_pernode_count{$node.",".$ctr} += 1; } if ($ctr_set eq "AC" || $ctr_set eq "ac") { $ac_total{$ctr} += $persec{$ind}; $ac_total_count{$ctr} += 1; $node = $part_num >> $AcExp; $ac_pernode{$node.",".$ctr} += $persec{$ind}; $ac_pernode_count{$node.",".$ctr} += 1; } } if ($eavgonly) { &print_event_averages(); print "\n"; } if ($avgonly) { &print_all_averages(); } if ($cpuonly) { printf "CPU statistics\n"; printf "--------------\n"; &print_cpu_cpi_breakdown(); printf "\n"; &print_cpu_mips(); printf "\n"; &print_cpu_cache_stats(); printf "\n"; } if ($ukonly) { printf "CPU user mode statistics\n"; printf "------------------------\n"; &print_user_cpu_cpi_breakdown(); printf "\n"; &print_user_cpu_mips(); printf "\n"; &print_user_cpu_cache_stats(); printf "\n"; printf "CPU kernel mode statistics\n"; printf "--------------------------\n"; &print_kernel_cpu_cpi_breakdown(); printf "\n"; &print_kernel_cpu_mips(); printf "\n"; &print_kernel_cpu_cache_stats(); printf "\n"; } if ($aconly) { printf "Gigaplane Bus Statistics\n"; printf "------------------------\n"; &print_ac_gigaplane_stats(); print "\n"; printf "Memory Banks Statistics\n"; printf "-----------------------\n"; &print_ac_membank_stats(); print "\n"; } if ($sysioonly) { printf "Sbus I/O Bus Statistics\n"; printf "-----------------------\n"; &print_sysio_stats(); print "\n"; } if ($wfionly) { &print_wfi_total_tx(); &print_wfi_ratios(); print "\n"; } sub print_event_averages { local ($ctr); print "Event_Name #events/sec #instances #events/sec/instance\n"; #print "CPU\n"; print "\n"; foreach $ctr (sort (keys %cpu_total)) { printf("%s %.4f %d %.4f\n", $ctr, $cpu_total{$ctr}, $cpu_total_count{$ctr}, $cpu_total{$ctr}/$cpu_total_count{$ctr}); } #print "AC\n"; print "\n"; foreach $ctr (sort (keys %ac_total)) { printf("%s %.4f %d %.4f\n", $ctr, $ac_total{$ctr}, $ac_total_count{$ctr}, $ac_total{$ctr}/$ac_total_count{$ctr}); } #print "SYSIO\n"; print "\n"; foreach $ctr (sort (keys %sysio_total)) { printf("%s %.4f %d %.4f\n", $ctr, $sysio_total{$ctr}, $sysio_total_count{$ctr}, $sysio_total{$ctr}/$sysio_total_count{$ctr}); } #print "WFI\n"; print "\n"; foreach $ctr (sort (keys %wfi_total)) { printf("%s %.4f %d %.4f\n", $ctr, $wfi_total{$ctr}, $wfi_total_count{$ctr}, $wfi_total{$ctr}/$wfi_total_count{$ctr}); } } sub print_all_averages { local ($before, %part_name, $key, $ctr_set, $part_num, $mode, $ctr); $before = "none"; print "Event_name #events/sec Instance_Type Instance_number\n"; foreach $key (sort mycmp (keys %time)) { ($ctr_set, $part_num, $ctr) = split(",",$key); if ( $before ne $ctr_set ) { print "\n";} printf("%s %.4f %s %d\n", $ctr, $persec{$key}, $ctr_set, $part_num); $before = $ctr_set; } } sub mycmp { ($ctr_set_a, $part_num_a, $mode_a, $ctr_a) = split(",", $a); ($ctr_set_b, $part_num_b, $mode_b, $ctr_b) = split(",", $b); $ctr_set_a cmp $ctr_set_b || $part_num_a <=> $part_num_b || $ctr_a cmp $ctr_b; } sub print_cpu_cpi_breakdown { print "CPI LdUse IcMiss BrMiss StBuf RaW FpUse\n"; &print_one_cpu_ratio_tab("clock_cycles", "instructions"); &print_one_cpu_ratio_tab("load_use", "instructions"); &print_one_cpu_ratio_tab("dispatch0_ic_miss", "instructions"); &print_one_cpu_ratio_tab("dispatch0_mispred", "instructions"); &print_one_cpu_ratio_tab("dispatch0_storebuf", "instructions"); &print_one_cpu_ratio_tab("load_use_raw", "instructions"); &print_one_cpu_ratio_tab("dispatch0_fp_use", "instructions"); printf "\n"; } sub print_user_cpu_cpi_breakdown { print "CPI LdUse IcMiss BrMiss StBuf RaW FpUse\n"; &print_one_user_cpu_ratio_tab("clock_cycles", "instructions"); &print_one_user_cpu_ratio_tab("load_use", "instructions"); &print_one_user_cpu_ratio_tab("dispatch0_ic_miss", "instructions"); &print_one_user_cpu_ratio_tab("dispatch0_mispred", "instructions"); &print_one_user_cpu_ratio_tab("dispatch0_storebuf", "instructions"); &print_one_user_cpu_ratio_tab("load_use_raw", "instructions"); &print_one_user_cpu_ratio_tab("dispatch0_fp_use", "instructions"); printf "\n"; } sub print_kernel_cpu_cpi_breakdown { print "CPI LdUse IcMiss BrMiss StBuf RaW FpUse\n"; &print_one_kernel_cpu_ratio_tab("clock_cycles", "instructions"); &print_one_kernel_cpu_ratio_tab("load_use", "instructions"); &print_one_kernel_cpu_ratio_tab("dispatch0_ic_miss", "instructions"); &print_one_kernel_cpu_ratio_tab("dispatch0_mispred", "instructions"); &print_one_kernel_cpu_ratio_tab("dispatch0_storebuf", "instructions"); &print_one_kernel_cpu_ratio_tab("load_use_raw", "instructions"); &print_one_kernel_cpu_ratio_tab("dispatch0_fp_use", "instructions"); printf "\n"; } sub print_cpu_mips { local ($node, $key); print "MIPS\n"; printf("%.0f ", $cpu_total{"instructions"}); printf "\n"; } sub print_user_cpu_mips { local ($node, $key); print "MIPS\n"; printf("%.0f ", $user_cpu_total{"instructions"}); printf "\n"; } sub print_kernel_cpu_mips { local ($node, $key); print "MIPS\n"; printf("%.0f ", $kernel_cpu_total{"instructions"}); printf "\n"; } sub print_cpu_cache_stats { print "IcMiss DcMiss EcMiss EcWB DrtyRd\n"; &print_cpu_icmiss(); &print_cpu_dcmiss(); &print_cpu_ecmiss(); &print_one_cpu_ratio_pct("ec_wb", "instructions"); if (defined $cpu_total{"ec_snoop_cb"} && defined $ac_total{"addr_pkts"} && $ac_total{"addr_pkts"} != 0 ) { printf("%.1f%% ", $cpu_total{"ec_snoop_cb"}/($ac_total{"addr_pkts"}/$ac_total_count{"addr_pkts"}) * 100 ); } else { return; } printf "\n"; } sub print_user_cpu_cache_stats { print "IcMiss DcMiss EcMiss EcWB\n"; &print_user_cpu_icmiss(); &print_user_cpu_dcmiss(); &print_user_cpu_ecmiss(); &print_one_user_cpu_ratio_pct("ec_wb", "instructions"); printf "\n"; } sub print_kernel_cpu_cache_stats { print "IcMiss DcMiss EcMiss EcWB\n"; &print_kernel_cpu_icmiss(); &print_kernel_cpu_dcmiss(); &print_kernel_cpu_ecmiss(); &print_one_kernel_cpu_ratio_pct("ec_wb", "instructions"); printf "\n"; } sub print_wfi_total_tx { local($node, $k1, $k2, $k3, $k4, $k5); print "million tx per second on the wfi interconnect\n"; printf("Overall : %.3f\n",$wfi_total{"remote_NUMA_coherent_transacti"}+ $wfi_total{"remote_non-coherent_transactio"}+ $wfi_total{"MTAG_miss_transactions"}+ $wfi_total{"remote_interrupt_transactions"}+ $wfi_total{"WFI_generated_transactions"}); printf("Per Node : "); for ($node=0; $node<$SSMNodes; $node++) { $k1=join(",", ("WFI",$node,"remote_NUMA_coherent_transacti")); $k2=join(",", ("WFI",$node,"remote_non-coherent_transactio")); $k3=join(",", ("WFI",$node,"MTAG_miss_transactions")); $k4=join(",", ("WFI",$node,"remote_interrupt_transactions")); $k5=join(",", ("WFI",$node,"WFI_generated_transactions")); if ( !defined $persec{$k1} ) { next;} printf("%.3f(%d) ", $persec{$k1} + $persec{$k2} + $persec{$k3} + $persec{$k4} + $persec{$k5}, $node); } printf("\n\n"); } sub print_wfi_ratios { print "remote/local coherent tx ratio\n"; &print_one_wfi_ratio("remote_NUMA_coherent_transacti", "local_coherent_transactions"); printf("\n\n"); print "mtag miss-shared/ mtag miss ratio\n"; &print_one_wfi_ratio("MTAG_miss_shared_transactions", "MTAG_miss_transactions"); printf("\n\n"); print "GA2LPA cache hit ratio\n"; &print_one_wfi_ratio("GA2LPA_cache_hits", "GA2LPA_cache_total_accesses"); printf("\n\n"); print "Directory cache hit ratio\n"; &print_one_wfi_ratio("directory_cache_hits", "directory_cache_total_accesses"); printf("\n\n"); print "NUMA excess miss/remote NUMA coherent tx ratio\n"; &print_one_wfi_ratio("NUMA_excess_misses", "remote_NUMA_coherent_transacti"); printf("\n\n"); print "MTAG misses/local coherent tx ratio\n"; &print_one_wfi_ratio("MTAG_miss_transactions", "local_coherent_transactions"); printf("\n\n"); } sub print_one_wfi_ratio { local ($ctr1, $ctr2) = ($_[0], $_[1]); local ($node, $key1, $key2); if (defined $wfi_total{$ctr1} && defined $wfi_total{$ctr2} && $wfi_total{$ctr2} != 0 ) { printf("Overall : %.3f\n",$wfi_total{$ctr1}/ $wfi_total{$ctr2}); } else { return;} printf("Per Node : "); for ($node=0; $node < $SSMNodes; $node++) { $key1="WFI".",".$node.","."$ctr1"; $key2="WFI".",".$node.","."$ctr2"; if (defined $persec{$key1} && defined $persec{$key2} && $persec{$key2} != 0 ) { printf("%.3f(%d) ",$persec{$key1}/$persec{$key2},$node); } } } sub print_one_cpu_ratio_tab { local ($ctr1, $ctr2) = ($_[0], $_[1]); local ($node, $key1, $key2); if (defined $cpu_total{$ctr1} && defined $cpu_total{$ctr2} && $cpu_total{$ctr2} != 0 ) { printf("%.3f ", $cpu_total{$ctr1}/$cpu_total{$ctr2}); } else { printf(" empty "); } } sub print_one_user_cpu_ratio_tab { local ($ctr1, $ctr2) = ($_[0], $_[1]); local ($node, $key1, $key2); if (defined $user_cpu_total{$ctr1} && defined $user_cpu_total{$ctr2} && $user_cpu_total{$ctr2} != 0 ) { printf("%.3f ", $user_cpu_total{$ctr1}/$user_cpu_total{$ctr2}); } else { return; } } sub print_one_kernel_cpu_ratio_tab { local ($ctr1, $ctr2) = ($_[0], $_[1]); local ($node, $key1, $key2); if (defined $kernel_cpu_total{$ctr1} && defined $kernel_cpu_total{$ctr2} && $kernel_cpu_total{$ctr2} != 0 ) { printf("%.3f ", $kernel_cpu_total{$ctr1}/$kernel_cpu_total{$ctr2}); } else { return; } } sub print_one_cpu_ratio_pct { local ($ctr1, $ctr2) = ($_[0], $_[1]); local ($node, $key1, $key2); if (defined $cpu_total{$ctr1} && defined $cpu_total{$ctr2} && $cpu_total{$ctr2} != 0 ) { printf("%.2f%% ", $cpu_total{$ctr1}/$cpu_total{$ctr2}* 100); } else { return; } } sub print_one_user_cpu_ratio_pct { local ($ctr1, $ctr2) = ($_[0], $_[1]); local ($node, $key1, $key2); if (defined $user_cpu_total{$ctr1} && defined $user_cpu_total{$ctr2} && $user_cpu_total{$ctr2} != 0 ) { printf("%.2f%% ", $user_cpu_total{$ctr1}/$user_cpu_total{$ctr2}* 100); } else { return; } } sub print_one_kernel_cpu_ratio_pct { local ($ctr1, $ctr2) = ($_[0], $_[1]); local ($node, $key1, $key2); if (defined $kernel_cpu_total{$ctr1} && defined $kernel_cpu_total{$ctr2} && $kernel_cpu_total{$ctr2} != 0 ) { printf("%.2f%% ", $kernel_cpu_total{$ctr1}/$kernel_cpu_total{$ctr2}* 100); } else { return; } } sub print_cpu_icmiss { local($node, $k1, $k2, $k3); if (defined $cpu_total{"ic_ref"} && defined $cpu_total{"ic_hit"} && defined $cpu_total{"instructions"} && $cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", ($cpu_total{"ic_ref"} - $cpu_total{"ic_hit"}) / $cpu_total{"instructions"} * 100 ); } else { return; } } sub print_user_cpu_icmiss { local($node, $k1, $k2, $k3); if (defined $user_cpu_total{"ic_ref"} && defined $user_cpu_total{"ic_hit"} && defined $user_cpu_total{"instructions"} && $user_cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", ($user_cpu_total{"ic_ref"} - $user_cpu_total{"ic_hit"}) / $user_cpu_total{"instructions"} * 100 ); } else { return; } } sub print_kernel_cpu_icmiss { local($node, $k1, $k2, $k3); if (defined $kernel_cpu_total{"ic_ref"} && defined $kernel_cpu_total{"ic_hit"} && defined $kernel_cpu_total{"instructions"} && $kernel_cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", ($kernel_cpu_total{"ic_ref"} - $kernel_cpu_total{"ic_hit"}) / $kernel_cpu_total{"instructions"} * 100 ); } else { return; } } sub print_cpu_ecmiss { local($node, $k1, $k2, $k3); if (defined $cpu_total{"ec_ref"} && defined $cpu_total{"ec_hit"} && defined $cpu_total{"instructions"} && $cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", ($cpu_total{"ec_ref"} - $cpu_total{"ec_hit"}) / $cpu_total{"instructions"} * 100 ); } else { return; } } sub print_user_cpu_ecmiss { local($node, $k1, $k2, $k3); if (defined $user_cpu_total{"ec_ref"} && defined $user_cpu_total{"ec_hit"} && defined $user_cpu_total{"instructions"} && $user_cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", ($user_cpu_total{"ec_ref"} - $user_cpu_total{"ec_hit"}) / $user_cpu_total{"instructions"} * 100 ); } else { return; } } sub print_kernel_cpu_ecmiss { local($node, $k1, $k2, $k3); if (defined $kernel_cpu_total{"ec_ref"} && defined $kernel_cpu_total{"ec_hit"} && defined $kernel_cpu_total{"instructions"} && $kernel_cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", ($kernel_cpu_total{"ec_ref"} - $kernel_cpu_total{"ec_hit"}) / $kernel_cpu_total{"instructions"} * 100 ); } else { return; } } sub print_cpu_dcmiss { local($node, $k1, $k2, $k3, $k4, $k5); if (defined $cpu_total{"dc_read_hit"} && defined $cpu_total{"dc_write_hit"} && defined $cpu_total{"dc_read"} && defined $cpu_total{"dc_write"} && defined $cpu_total{"instructions"} && $cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", (($cpu_total{"dc_read"} + $cpu_total{"dc_write"}) - ($cpu_total{"dc_read_hit"} + $cpu_total{"dc_write_hit"})) / $cpu_total{"instructions"} * 100 ); } else { return; } } sub print_user_cpu_dcmiss { local($node, $k1, $k2, $k3, $k4, $k5); if (defined $user_cpu_total{"dc_read_hit"} && defined $user_cpu_total{"dc_write_hit"} && defined $user_cpu_total{"dc_read"} && defined $user_cpu_total{"dc_write"} && defined $user_cpu_total{"instructions"} && $user_cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", (($user_cpu_total{"dc_read"} + $user_cpu_total{"dc_write"}) - ($user_cpu_total{"dc_read_hit"} + $user_cpu_total{"dc_write_hit"})) / $user_cpu_total{"instructions"} * 100 ); } else { return; } } sub print_kernel_cpu_dcmiss { local($node, $k1, $k2, $k3, $k4, $k5); if (defined $kernel_cpu_total{"dc_read_hit"} && defined $kernel_cpu_total{"dc_write_hit"} && defined $kernel_cpu_total{"dc_read"} && defined $kernel_cpu_total{"dc_write"} && defined $kernel_cpu_total{"instructions"} && $kernel_cpu_total{"instructions"} != 0 ) { printf("%.2f%% ", (($kernel_cpu_total{"dc_read"} + $kernel_cpu_total{"dc_write"}) - ($kernel_cpu_total{"dc_read_hit"} + $kernel_cpu_total{"dc_write_hit"})) / $kernel_cpu_total{"instructions"} * 100 ); } else { return; } } sub usage { print " usage : $0 [-i <infile>] [-o <outfile>] [-v] [<infile>] -i <name>: input file name -o <name>: output file name -v : turn on verbose -ac : print only AC related data -cpu : print only CPU related data -sysio : print only SYSIO related data -wfi : print only WFI related data\n -avg : print only the per second counter values -eavg : print only the per second event counts \n"; exit 1; } sub print_ac_gigaplane_stats { print "AbUtil DbUtil RTS RTSA RTO WB\n"; &print_ac_abutil(); &print_ac_dbutil(); &print_ac_getone("rts_pkts"); &print_ac_getone("rtsa_pkts"); &print_ac_getone("rto_pkts"); &print_ac_getone("wb_pkts"); print "\n"; print "RIO WIO RBIO WBIO RS WS\n"; &print_ac_getone("rio_pkts"); &print_ac_getone("wio_pkts"); &print_ac_getone("rbio_pkts"); &print_ac_getone("wbio_pkts"); &print_ac_getone("rs_pkts"); &print_ac_getone("ws_pkts"); print "\n"; } sub print_ac_getone { local($ctr) = ($_[0]); local(%val, $node, $key, $oval); if (!defined $ac_total{$ctr}) { return;} for ($node=0; $node < $SSMNodes; $node++) { $key = $node.",".$ctr; if (defined $ac_pernode{$key}) { $val{$node} = $ac_pernode{$key}/$ac_pernode_count{$key}; $oval += $val{$node}; } } printf("%.3f ", $oval); } sub print_ac_abutil { local ($node, $key1, $key2, $str, $sum, $cnt, $val); if (!defined $ac_total{"addr_pkts"} || !defined $ac_total{"clock_cycles"} ) { return; } for ($node=0; $node < $SSMNodes; $node++) { $key1 = $node.","."addr_pkts"; $key2 = $node.","."clock_cycles"; if (defined $ac_pernode{$key1} && defined $ac_pernode{$key2} ) { $val = (($ac_pernode{$key1}/$ac_pernode_count{$key1}) * 2) / ($ac_pernode{$key2}/$ac_pernode_count{$key2}); $str = $str . sprintf("%.3f(%d) ", $val, $node); $sum += $val; $cnt += 1; } } printf("%.1f%% ", $sum/$cnt * 100); } sub print_ac_dbutil { local ($node, $key1, $key2, $str, $sum, $cnt, $val); if (!defined $ac_total{"data_pkts"} || !defined $ac_total{"clock_cycles"} ) { return; } for ($node=0; $node < $SSMNodes; $node++) { $key1 = $node.","."data_pkts"; $key2 = $node.","."clock_cycles"; if (defined $ac_pernode{$key1} && defined $ac_pernode{$key2} ) { $val = (($ac_pernode{$key1}/$ac_pernode_count{$key1}) * 2) / ($ac_pernode{$key2}/$ac_pernode_count{$key2}); $str = $str . sprintf("%.3f(%d) ", $val, $node); $sum += $val; $cnt += 1; } } printf("%.1f%% ", $sum/$cnt * 100); } sub print_ac_membank_stats { local ($i); local($key_r0, $key_w0, $key_r1, $key_w1); local ($r_total, $w_total) = 0; print "Board Bank BrdUtil BnkUtil Mrd/sec Mwr/sec\n"; for ($i=0; $i < (1 << $AcExp) * $SSMNodes; $i++) { $key_r0 = join(",",("ac", $i, "NA", "mem_bank0_rds")); $key_w0 = join(",",("ac", $i, "NA", "mem_bank0_wrs")); $key_r1 = join(",",("ac", $i, "NA", "mem_bank1_rds")); $key_w1 = join(",",("ac", $i, "NA", "mem_bank1_wrs")); if (defined $persec{$key_r0} && defined $persec{$key_w0} && defined $persec{$key_r1} && defined $persec{$key_w1} ) { $bank_util_0 = ($persec{$key_r0} + $persec{$key_w0}) / $MC_CAP * 100; $bank_util_1 = ($persec{$key_r1} + $persec{$key_w1}) / $MC_CAP * 100; $brd_util = ($bank_util_0 + $bank_util_1) * $MC_CAP / $MC_BDCAP; if ($brd_util > 0) { printf("%d %d %.2f%% %.2f%% %.3f %.3f\n", $i, 0, $brd_util, $bank_util_0, $persec{$key_r0}, $persec{$key_w0}); printf("%d %d %.2f%% %.2f%% %.3f %.3f\n", $i, 1, $brd_util, $bank_util_1, $persec{$key_r1}, $persec{$key_w1}); $r_total += ($persec{$key_r0} + $persec{$key_r1}); $w_total += ($persec{$key_w0} + $persec{$key_w1}); } } } printf("Total %.3f %.3f\n", $r_total, $w_total); print "\n"; } sub print_sysio_stats { local ($i); local($key_x, $key_i, $val_x, $val_i); local($total_x, $total_i) = 0; print "Ctl# MB/sec Kintr/sec\n"; for ($i=0; $i < (1<<$SysioExp) * $SSMNodes; $i++) { $key_x = join(",",("sbus",$i,"NA","dvma_bytes_xfr")); $key_i = join(",",("sbus",$i,"NA","interrupts")); if (defined $persec{$key_x} || defined $persec{$key_i}) { if (defined $persec{$key_x}) { $val_x = $persec{$key_x}; } else { $val_x = -1.0; } if (defined $persec{$key_i}) { $val_i = $persec{$key_i}; } else { $val_i = -1.0; } printf("%d %.3f %.1f\n", $i, $val_x, $val_i * 1000); $total_x += $val_x; $total_i += $val_i; } } printf("Total %.3f %.1f\n", $total_x, $total_i * 1000); }
_______________________________________________ perf-discuss mailing list perf-discuss@opensolaris.org