Line 60... |
Line 60... |
my @results;
|
my @results;
|
$results[0]=[0];
|
$results[0]=[0];
|
$results[1]= [0];
|
$results[1]= [0];
|
my $legend_info="This attribute controls placement of the legend within the graph image. The value is supplied as a two-letter string, where the first letter is placement (a B or an R for bottom or right, respectively) and the second is alignment (L, R, C, T, or B for left, right, center, top, or bottom, respectively). ";
|
my $legend_info="This attribute controls placement of the legend within the graph image. The value is supplied as a two-letter string, where the first letter is placement (a B or an R for bottom or right, respectively) and the second is alignment (L, R, C, T, or B for left, right, center, top, or bottom, respectively). ";
|
|
|
|
my $fontsize="Tiny,Small,MediumBold,Large,Giant";
|
|
|
|
|
|
|
my @ginfo = (
|
my @ginfo = (
|
{ label=>"Graph Title", param_name=>"G_Title", type=>"Entry", default_val=>undef, content=>undef, info=>undef, param_parent=>'graph_param', ref_delay=>undef },
|
#{ label=>"Graph Title", param_name=>"G_Title", type=>"Entry", default_val=>undef, content=>undef, info=>undef, param_parent=>'graph_param', ref_delay=>undef },
|
{ label=>"Y Axix Title", param_name=>"Y_Title", type=>"Entry", default_val=>'Latency (clock)', content=>undef, info=>undef, param_parent=>'graph_param', ref_delay=>undef },
|
{ label=>"Y Axix Title", param_name=>"Y_Title", type=>"Entry", default_val=>'Latency (clock)', content=>undef, info=>undef, param_parent=>'graph_param', ref_delay=>undef },
|
{ label=>"X Axix Title", param_name=>"X_Title", type=>"Entry", default_val=>'Load per router (flits/clock (%))', content=>undef, info=>undef, param_parent=>'graph_param',ref_delay=>undef },
|
{ label=>"X Axix Title", param_name=>"X_Title", type=>"Entry", default_val=>'Load per router (flits/clock (%))', content=>undef, info=>undef, param_parent=>'graph_param',ref_delay=>undef },
|
{ label=>"legend placement", param_name=>"legend_placement", type=>'Combo-box', default_val=>'BL', content=>"BL,BC,BR,RT,RC,RB", info=>$legend_info, param_parent=>'graph_param', ref_delay=>undef},
|
{ label=>"legend placement", param_name=>"legend_placement", type=>'Combo-box', default_val=>'BL', content=>"BL,BC,BR,RT,RC,RB", info=>$legend_info, param_parent=>'graph_param', ref_delay=>1},
|
|
|
{ label=>"Y min", param_name=>"Y_MIN", type=>'Spin-button', default_val=>0, content=>"0,1024,1", info=>"Y axix minimum value", param_parent=>'graph_param', ref_delay=> 5},
|
{ label=>"Y min", param_name=>"Y_MIN", type=>'Spin-button', default_val=>0, content=>"0,1024,1", info=>"Y axix minimum value", param_parent=>'graph_param', ref_delay=> 5},
|
{ label=>"X min", param_name=>"X_MIN", type=>'Spin-button', default_val=>0, content=>"0,1024,1", info=>"X axix minimum value", param_parent=>'graph_param', ref_delay=> 5},
|
{ label=>"X min", param_name=>"X_MIN", type=>'Spin-button', default_val=>0, content=>"0,1024,1", info=>"X axix minimum value", param_parent=>'graph_param', ref_delay=> 5},
|
{ label=>"X max", param_name=>"X_MAX", type=>'Spin-button', default_val=>100, content=>"0,1024,1", info=>"X axix maximum value", param_parent=>'graph_param', ref_delay=> 5},
|
{ label=>"X max", param_name=>"X_MAX", type=>'Spin-button', default_val=>100, content=>"0,1024,1", info=>"X axix maximum value", param_parent=>'graph_param', ref_delay=> 5},
|
{ label=>"Line Width", param_name=>"LINEw", type=>'Spin-button', default_val=>3, content=>"1,20,1", info=>undef, param_parent=>'graph_param', ref_delay=> 5},
|
{ label=>"Line Width", param_name=>"LINEw", type=>'Spin-button', default_val=>3, content=>"1,20,1", info=>undef, param_parent=>'graph_param', ref_delay=> 5},
|
|
{ label=>"legend font size", param_name=>"legend_font", type=>'Combo-box', default_val=>'MediumBold', content=>$fontsize, info=>undef, param_parent=>'graph_param', ref_delay=>1},
|
|
{ label=>"label font size", param_name=>"label_font", type=>'Combo-box', default_val=>'MediumBold', content=>$fontsize, info=>undef, param_parent=>'graph_param', ref_delay=>1},
|
|
{ label=>"label font size", param_name=>"x_axis_font", type=>'Combo-box', default_val=>'MediumBold', content=>$fontsize, info=>undef, param_parent=>'graph_param', ref_delay=>1},
|
);
|
);
|
|
|
|
|
|
|
|
|
Line 145... |
Line 151... |
|
|
|
|
my $graphs_info;
|
my $graphs_info;
|
foreach my $d ( @ginfo){
|
foreach my $d ( @ginfo){
|
$graphs_info->{$d->{param_name}}=$emulate->object_get_attribute( 'graph_param',$d->{param_name});
|
$graphs_info->{$d->{param_name}}=$emulate->object_get_attribute( 'graph_param',$d->{param_name});
|
$graphs_info->{$d->{param_name}}= $d->{default_val} if(!defined $graphs_info->{$d->{param_name}});
|
if(!defined $graphs_info->{$d->{param_name}}){
|
|
$graphs_info->{$d->{param_name}}= $d->{default_val};
|
|
$emulate->object_add_attribute( 'graph_param',$d->{param_name},$d->{default_val} );
|
|
}
|
}
|
}
|
|
|
|
|
|
|
$graph->set (
|
$graph->set (
|
Line 163... |
Line 172... |
bar_spacing => 1,
|
bar_spacing => 1,
|
shadowclr => 'dred',
|
shadowclr => 'dred',
|
|
|
box_axis => 0,
|
box_axis => 0,
|
skip_undef=> 1,
|
skip_undef=> 1,
|
transparent => 1,
|
# transparent => 1,
|
|
|
|
transparent => '0',
|
|
bgclr => 'white',
|
|
boxclr => 'white',
|
|
fgclr => 'black',
|
|
textclr => 'black',
|
|
labelclr => 'black',
|
|
axislabelclr => 'black',
|
|
legendclr => 'black',
|
|
cycle_clrs => '1',
|
|
|
line_width => $graphs_info->{LINEw},
|
line_width => $graphs_info->{LINEw},
|
cycle_clrs => 'blue',
|
# cycle_clrs => 'black',
|
legend_placement => $graphs_info->{legend_placement},
|
legend_placement => $graphs_info->{legend_placement},
|
dclrs=>\@color,
|
dclrs=>\@color,
|
|
y_number_format=>"%.1f",
|
|
BACKGROUND=>'black',
|
|
|
);
|
);
|
}#if
|
}#if
|
$graph->set_legend(@legend_keys);
|
$graph->set_legend(@legend_keys);
|
|
|
|
|
Line 315... |
Line 338... |
|
|
sub my_get_image {
|
sub my_get_image {
|
my ($emulate,$self, $data) = @_;
|
my ($emulate,$self, $data) = @_;
|
$self->{graphdata} = $data;
|
$self->{graphdata} = $data;
|
my $graph = $self->{graph};
|
my $graph = $self->{graph};
|
|
my $font;
|
|
|
|
$font= $emulate->object_get_attribute( 'graph_param','label_font');
|
|
$graph->set_x_label_font(GD::Font->$font);
|
|
$graph->set_y_label_font(GD::Font->$font);
|
|
$font= $emulate->object_get_attribute( 'graph_param','legend_font');
|
|
$graph->set_legend_font(GD::Font->$font);
|
|
|
|
$font= $emulate->object_get_attribute( 'graph_param','x_axis_font');
|
|
#$graph->set_values_font(GD::gdGiantFont);
|
|
$graph->set_x_axis_font(GD::Font->$font);
|
|
$graph->set_y_axis_font(GD::Font->$font);
|
|
|
my $gd2=$graph->plot($data) or warn $graph->error;
|
my $gd2=$graph->plot($data) or warn $graph->error;
|
my $loader = Gtk2::Gdk::PixbufLoader->new;
|
my $loader = Gtk2::Gdk::PixbufLoader->new;
|
|
|
|
|
#cut the upper side of the image to remove the stright line created by chaanging large results to ymax
|
#cut the upper side of the image to remove the stright line created by chaanging large results to ymax
|
Line 436... |
Line 472... |
# get_graph_setting
|
# get_graph_setting
|
###########
|
###########
|
|
|
sub get_graph_setting {
|
sub get_graph_setting {
|
my ($emulate,$ref)=@_;
|
my ($emulate,$ref)=@_;
|
my($width,$hight)=max_win_size();
|
my $window=def_popwin_size(33,33,'Graph Setting','percent');
|
my $window=def_popwin_size($width/3,$hight/3,'Graph Setting');
|
|
my $table = def_table(10, 2, FALSE);
|
my $table = def_table(10, 2, FALSE);
|
my $row=0;
|
my $row=0;
|
|
|
|
|
my @data=@$ref;
|
my @data=@$ref;
|
Line 488... |
Line 523... |
# get_color_window
|
# get_color_window
|
###############
|
###############
|
|
|
sub get_color_window{
|
sub get_color_window{
|
my ($emulate,$atrebute1,$atrebute2)=@_;
|
my ($emulate,$atrebute1,$atrebute2)=@_;
|
my $window=def_popwin_size(800,600,"Select line color");
|
my $window=def_popwin_size(40,40,"Select line color",'percent');
|
my ($r,$c)=(4,8);
|
my ($r,$c)=(4,8);
|
my $table= def_table(5,6,TRUE);
|
my $table= def_table(5,6,TRUE);
|
for (my $col=0;$col<$c;$col++){
|
for (my $col=0;$col<$c;$col++){
|
for (my $row=0;$row<$r;$row++){
|
for (my $row=0;$row<$r;$row++){
|
my $color_num=$row*$c+$col;
|
my $color_num=$row*$c+$col;
|
Line 744... |
Line 779... |
|
|
sub gen_emulation_column {
|
sub gen_emulation_column {
|
my ($emulate,$mode, $row_num,$info)=@_;
|
my ($emulate,$mode, $row_num,$info)=@_;
|
my $table=def_table($row_num,10,FALSE);
|
my $table=def_table($row_num,10,FALSE);
|
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
|
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
|
my($width,$hight)=max_win_size();
|
my $set_win=def_popwin_size(40,80,"NoC configuration setting",'percent');
|
my $set_win=def_popwin_size($width/2.5,$hight*.8,"NoC configuration setting");
|
|
|
|
$scrolled_win->set_policy( "automatic", "automatic" );
|
$scrolled_win->set_policy( "automatic", "automatic" );
|
$scrolled_win->add_with_viewport($table);
|
$scrolled_win->add_with_viewport($table);
|
my $row=0;
|
my $row=0;
|
|
|
Line 1060... |
Line 1094... |
my $status= $emulate->object_get_attribute ("sample$i","status");
|
my $status= $emulate->object_get_attribute ("sample$i","status");
|
$status='' if(!defined $status);
|
$status='' if(!defined $status);
|
my $image;
|
my $image;
|
my $vbox = Gtk2::HBox->new (TRUE,1);
|
my $vbox = Gtk2::HBox->new (TRUE,1);
|
$image = Gtk2::Image->new_from_file ("icons/load.gif") if($status eq "run");
|
$image = Gtk2::Image->new_from_file ("icons/load.gif") if($status eq "run");
|
$image = def_image("icons/button_ok.png") if($status eq "done");
|
$image = def_icon("icons/button_ok.png") if($status eq "done");
|
$image = def_image("icons/cancel.png") if($status eq "failed");
|
$image = def_icon("icons/cancel.png") if($status eq "failed");
|
#$image_file = "icons/load.gif" if($status eq "run");
|
#$image_file = "icons/load.gif" if($status eq "run");
|
|
|
if (defined $image) {
|
if (defined $image) {
|
my $align = Gtk2::Alignment->new (0.5, 0.5, 0, 0);
|
my $align = Gtk2::Alignment->new (0.5, 0.5, 0, 0);
|
my $frame = Gtk2::Frame->new;
|
my $frame = Gtk2::Frame->new;
|
Line 1629... |
Line 1663... |
my ($simulate,$info)=@_;
|
my ($simulate,$info)=@_;
|
#return if(!check_samples($emulate,$info));
|
#return if(!check_samples($emulate,$info));
|
$simulate->object_add_attribute('status',undef,'run');
|
$simulate->object_add_attribute('status',undef,'run');
|
set_gui_status($simulate,"ref",1);
|
set_gui_status($simulate,"ref",1);
|
show_info($info, "Start Simulation\n");
|
show_info($info, "Start Simulation\n");
|
|
my $name=$simulate->object_get_attribute ("simulate_name",undef);
|
|
my $log= (defined $name)? "$ENV{PRONOC_WORK}/simulate/$name.log": "$ENV{PRONOC_WORK}/simulate/sim.log";
|
|
#unlink $log; # remove old log file
|
|
|
my $sample_num=$simulate->object_get_attribute("emulate_num",undef);
|
my $sample_num=$simulate->object_get_attribute("emulate_num",undef);
|
for (my $i=1; $i<=$sample_num; $i++){
|
for (my $i=1; $i<=$sample_num; $i++){
|
my $status=$simulate->object_get_attribute ("sample$i","status");
|
my $status=$simulate->object_get_attribute ("sample$i","status");
|
next if($status ne "run");
|
next if($status ne "run");
|
Line 1674... |
Line 1711... |
foreach my $ratio_in (@ratios){
|
foreach my $ratio_in (@ratios){
|
|
|
add_info($info, "Run $bin with injection ratio of $ratio_in \% \n");
|
add_info($info, "Run $bin with injection ratio of $ratio_in \% \n");
|
my $cmd="$bin -t \"$patern\" -s $PCK_SIZE -n $PCK_NUM_LIMIT -c $SIM_CLOCK_LIMIT -i $ratio_in -p \"100,0,0,0,0\" -h \"$HOTSPOT_PERCENTAGE,$HOTSPOT_NUM,$HOTSPOT_CORE_1,$HOTSPOT_CORE_2,$HOTSPOT_CORE_3,$HOTSPOT_CORE_4,$HOTSPOT_CORE_5\"";
|
my $cmd="$bin -t \"$patern\" -s $PCK_SIZE -n $PCK_NUM_LIMIT -c $SIM_CLOCK_LIMIT -i $ratio_in -p \"100,0,0,0,0\" -h \"$HOTSPOT_PERCENTAGE,$HOTSPOT_NUM,$HOTSPOT_CORE_1,$HOTSPOT_CORE_2,$HOTSPOT_CORE_3,$HOTSPOT_CORE_4,$HOTSPOT_CORE_5\"";
|
add_info($info, "$cmd \n");
|
add_info($info, "$cmd \n");
|
|
my $time_strg = localtime;
|
|
append_text_to_file($log,"started at:$time_strg\n"); #save simulation output
|
my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout("$cmd");
|
my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout("$cmd");
|
if($exit){
|
if($exit){
|
add_info($info, "Error in running simulation: $stderr \n");
|
add_info($info, "Error in running simulation: $stderr \n");
|
return;
|
return;
|
}
|
}
|
|
|
|
append_text_to_file($log,$stdout); #save simulation output
|
|
$time_strg = localtime;
|
|
append_text_to_file($log,"Ended at:$time_strg\n"); #save simulation output
|
my @q =split (/average latency =/,$stdout);
|
my @q =split (/average latency =/,$stdout);
|
my $d=$q[1];
|
my $d=$q[1];
|
@q =split (/\n/,$d);
|
@q =split (/\n/,$d);
|
my $avg=$q[0];
|
my $avg=$q[0];
|
#my $avg = sprintf("%.1f", $avg);
|
#my $avg = sprintf("%.1f", $avg);
|