Changeset 109


Ignore:
Timestamp:
05/20/05 09:48:26 (19 years ago)
Author:
bastiaans
Message:

toga/toga-functions.php:

  • Load colors fixed
  • Now all nodes are imaged in clusterimage (bug fixed in loop)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/toga/toga-functions.php

    r108 r109  
    66include_once "$GANGLIA_PATH/ganglia.php";
    77
     8// Set cluster context so that Ganglia will
     9// provide us with the correct metrics array
     10//
    811global $context;
    912$context = 'cluster';
     
    1114include_once "$GANGLIA_PATH/get_ganglia.php";
    1215
     16// If php is compiled without globals
     17//
    1318if ( !empty( $_GET ) ) {
    1419        extract( $_GET );
    1520}
    1621
     22// Ganglia's array of host metrics
     23//
    1724global $metrics;
    1825
     
    361368        function colorHex( $color ) {
    362369       
    363                 $my_color = imageColorAllocate( $this->image, hexdec( substr( $color, 0, 2 )), hexdec( substr( $color, 2, 4 )), hexdec( substr( $color, 4, 6 )) );
     370                $my_color = imageColorAllocate( $this->image, hexdec( substr( $color, 0, 2 )), hexdec( substr( $color, 2, 2 )), hexdec( substr( $color, 4, 2 )) );
    364371
    365372                return $my_color;
     
    392399                $my_loadcolor = $this->colorHex( load_color($load) );
    393400
    394                 imageFilledRectangle( $this->image, $this->x, $this->y, $this->x+12, $this->y+12, $queuecolor );
    395                 imageFilledRectangle( $this->image, $this->x+2, $this->y+2, $this->x+10, $this->y+10, $my_loadcolor );
     401                imageFilledRectangle( $this->image, $this->x, $this->y, $this->x+11, $this->y+11, $queuecolor );
     402                imageFilledRectangle( $this->image, $this->x+1, $this->y+1, $this->x+10, $this->y+10, $my_loadcolor );
    396403
    397404                // Een job markering?
     
    407414                $load_one = $metrics[$this->hostname][load_one][VAL];
    408415                $load = ((float) $load_one)/$cpus;
     416                //printf( "hostname %s cpus %s load_one %s load %f\n", $this->hostname, $cpus, $load_one, $load );
    409417
    410418                $this->drawNode( $load );
     
    425433
    426434                $max_width = 250;
    427                 $node_width = 12;
     435                $node_width = 11;
    428436
    429437                $nodes = $mydatag->getNodes();
     
    453461
    454462                //printf( "imagecreate: %dx%d", ($nodes_per_row*$node_width), ($node_rows*$node_width) );
    455                 $image = imageCreateTrueColor( ($nodes_per_row*$node_width), ($node_rows*$node_width) );
     463                $image = imageCreateTrueColor( ($nodes_per_row*$node_width)+1, ($node_rows*$node_width)+1 );
    456464                $colorwhite = imageColorAllocate( $image, 255, 255, 255 );
    457465                imageFill( $image, 0, 0, $colorwhite );
     
    464472                                $y = ($n * $node_width);
    465473
    466                                 $cur_node = ($n * $nodes_per_row) + ($m + 1);
     474                                $cur_node = ($n * $nodes_per_row) + ($m);
    467475                                $host = $node_keys[$cur_node];
    468476
    469                                 if( isset( $nodes[$host] ) and ($cur_node <= $nodes_nr) ) {
     477                                //printf( "host %s curnode %s ", $host, $cur_node );
     478
     479                                if( isset( $nodes[$host] ) and ($cur_node < $nodes_nr) ) {
     480                                        //printf( "image %s\n", $host );
    470481                                        $node = new NodeImage( $image, $x, $y );
    471482                                        $node->setHostname( $host );
Note: See TracChangeset for help on using the changeset viewer.