Changeset 2403


Ignore:
Timestamp:
Aug 22, 2011, 9:03:55 AM (13 years ago)
Author:
gah
Message:
 
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/vtkviewer.tcl

    r2397 r2403  
    140140# ----------------------------------------------------------------------
    141141itcl::body Rappture::VtkViewer::constructor {hostlist args} {
    142     if {[catch {info level -1} caller]} {
    143         puts stderr "Enter constructor"
    144     } else {
    145         puts stderr "Enter constructor: $caller"
    146     }
    147 
    148142    # Rebuild event
    149143    $_dispatcher register !rebuild
     
    359353        set _height 500
    360354    }
    361     #puts stderr "screen size $_width $_height"
     355    #puts stderr "DoResize screen size $_width $_height"
    362356    set _start [clock clicks -milliseconds]
    363357    SendCmd "screen size $_width $_height"
     358
     359    # Must reset camera to have object scaling to take effect.
     360    SendCmd "camera reset all"
     361    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     362    $_arcball quaternion $q
     363    SendCmd "camera orient $q"
     364    SendCmd "camera zoom $_view(zoom)"
    364365    set _resizePending 0
    365366}
     
    371372    $_arcball resize $w $h
    372373    if { !$_resizePending } {
    373         $_dispatcher event -after 400 !resize
    374374        set _resizePending 1
     375        $_dispatcher event -after 100 !resize
    375376    }
    376377}
     
    726727        if { $_start > 0 } {
    727728            set finish [clock clicks -milliseconds]
    728             puts stderr "round trip time [expr $finish -$_start] milliseconds"
     729            #puts stderr "round trip time [expr $finish -$_start] milliseconds"
    729730            set _start 0
    730731        }
     
    13251326        3,0 $inner.lighting  -columnspan 4 -anchor w \
    13261327        4,0 $inner.edges -columnspan 4 -anchor w -pady 2 \
    1327         5,0 $inner.clear -anchor e -pady 2 \
     1328        6,0 $inner.clear -anchor e -pady 2 \
    13281329        6,1 $inner.opacity -columnspan 2 -pady 2 -fill x\
    13291330        6,3 $inner.opaque -anchor w -pady 2
  • trunk/packages/vizservers/nanoscale/server.c

    r2339 r2403  
    1 
    21#include <stdio.h>
    32#include <unistd.h>
     
    7776
    7877
    79 #include <syslog.h>
    80 #include <stdarg.h>
    81 
    82 #define ERROR(...)      LogMessage(LOG_ERR, __FILE__, __LINE__, __VA_ARGS__)
    83 #ifdef WANT_TRACE
    84 #define TRACE(...)      LogMessage(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
    85 #else
    86 #define TRACE(...)
    87 #endif
    88 #define WARN(...)       LogMessage(LOG_WARNING, __FILE__, __LINE__, __VA_ARGS__)
    89 #define INFO(...)       LogMessage(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)
    90 
    91 void
    92 LogMessage(int priority, const char *path, int lineNum, const char* fmt, ...)
    93 {
    94 #define MSG_LEN (2047)
    95     char message[MSG_LEN+1];
    96     const char *s;
    97     int length;
    98     va_list lst;
    99 
    100     va_start(lst, fmt);
    101     s = strrchr(path, '/');
    102     if (s == NULL) {
    103         s = path;
    104     } else {
    105         s++;
    106     }
    107     length = snprintf(message, MSG_LEN, "line %d of \"%s\": ", lineNum, s);
    108     length += vsnprintf(message + length, MSG_LEN - length, fmt, lst);
    109     message[MSG_LEN] = '\0';
    110     syslog(priority, message, length);
    111 }
    112 
    11378static void
    11479close_child(int pipe_fd)
     
    12893    }
    12994 
    130     INFO("processes=%d, memory=%d, load=%f\n", children, memory_in_use, load);
     95    printf("processes=%d, memory=%d, load=%f\n",
     96           children, memory_in_use, load);
    13197
    13298}
     
    139105            child_array[c].requests += value;
    140106#ifdef DEBUGGING
    141             INFO("Updating requests from pipefd %d to %f\n",
     107            printf("Updating requests from pipefd %d to %f\n",
    142108                   child_array[c].pipefd,
    143109                   child_array[c].requests);
     
    159125help(const char *argv0)
    160126{
    161     printf("Syntax: %s [-d] -b <broadcast port> -l <listen port> -s <subnet> -c 'command'\n",
     127    fprintf(stderr,
     128            "Syntax: %s [-d] -b <broadcast port> -l <listen port> -s <subnet> -c 'command'\n",
    162129            argv0);
    163130    exit(1);
     
    216183            maxCards = strtoul(optarg, 0, 0);
    217184            if ((maxCards < 1) || (maxCards > 10)) {
    218                 ERROR("bad number of max videocards specified\n");
     185                fprintf(stderr, "bad number of max videocards specified\n");
    219186                return 1;
    220187            }
     
    230197
    231198            if (listen_port[nservices] == -1) {
    232                 ERROR("Must specify -l port before each -c command.\n");
     199                fprintf(stderr,"Must specify -l port before each -c command.\n");
    233200                return 1;
    234201            }
     
    243210            send_addr.sin_addr.s_addr = htonl(inet_network(optarg));
    244211            if (send_addr.sin_addr.s_addr == -1) {
    245                 ERROR("Invalid subnet broadcast address");
     212                fprintf(stderr,"Invalid subnet broadcast address");
    246213                return 1;
    247214            }
    248215            break;
    249216        default:
    250             ERROR("Don't know what option '%c'.\n", c);
     217            fprintf(stderr,"Don't know what option '%c'.\n", c);
    251218            return 1;
    252219        }
     
    257224        int i;
    258225        for (i = 0; i < argc; i++) {
    259             INFO("argv[%d]=(%s)\n", i, argv[i]);
     226            fprintf(stderr, "argv[%d]=(%s)\n", i, argv[i]);
    260227        }
    261228        help(argv[0]);
     
    406373                }
    407374             
    408                 INFO("New connection from %s\n", inet_ntoa(newaddr.sin_addr));
     375                printf("New connection from %s\n", inet_ntoa(newaddr.sin_addr));
    409376                FD_SET(newfd, &saved_rfds);
    410377                maxfd = max(maxfd, newfd);
     
    428395            }
    429396            if (status != 8) {
    430                 ERROR("Bogus message from %s\n", inet_ntoa(peer_addr.sin_addr));
     397                fprintf(stderr,"Bogus message from %s\n",
     398                        inet_ntoa(peer_addr.sin_addr));
    431399                continue;
    432400            }
    433401            float peer_load = ntohl(buffer[0]);
    434402            int peer_procs = ntohl(buffer[1]);
     403            //printf("Load for %s is %f (%d processes).\n",
     404            //       inet_ntoa(peer_addr.sin_addr), peer_load, peer_procs);
    435405            int h;
    436406            int free_index=-1;
     
    439409                if (host_array[h].in_addr.s_addr == peer_addr.sin_addr.s_addr) {
    440410                    if (host_array[h].children != peer_procs) {
    441                         INFO("Load for %s is %f (%d processes).\n", inet_ntoa(peer_addr.sin_addr), peer_load, peer_procs);
     411                        printf("Load for %s is %f (%d processes).\n",
     412                               inet_ntoa(peer_addr.sin_addr), peer_load, peer_procs);
    442413                    }
    443414                    host_array[h].load = peer_load;
     
    482453                status = read(i, &msg, 4);
    483454                if (status != 4) {
    484                     ERROR("Bad status on read (%d).", status);
     455                    fprintf(stderr,"Bad status on read (%d).", status);
    485456                    FD_CLR(i, &saved_rfds);
    486457                    clear_service_fd(i);
     
    494465                memory_in_use += newmemory;
    495466                load += 2*INITIAL_LOAD;
    496                 INFO("Accepted new job with memory %d\n", newmemory);
     467                printf("Accepted new job with memory %d\n", newmemory);
     468                //printf("My load is now %f\n", load);
    497469             
    498470                // accept the connection.
    499471                msg = 0;
    500472                if (write(i, &msg, 4) != 4) {
    501                     ERROR("short write for hostname\n");
     473                    fprintf(stderr, "short write for hostname\n");
    502474                }
    503475             
     
    535507                                int fd;
    536508
    537                                 dup2(i, 0); // stdin
    538                                 dup2(i, 1); // stdout
    539                                 dup2(i, 2); // stderr
     509                                dup2(i, 0);  // stdin
     510                                dup2(i, 1);  // stdout
     511                                dup2(i, 2);  // stderr
    540512                                dup2(pair[1],3);
    541513                                // read end of pipe moved, and left open to
     
    549521                                    displayVar[11] = dispNum + '0';
    550522                                }
    551                                 fprintf(stderr, "command=%s\n",
    552                                         command_argv[n][0]);
    553                                 if (execvp(command_argv[n][0], command_argv[n]) < 1) {
    554                                     extern int errno;
    555 
    556                                     ERROR("can't execute \"%s\": %s\n",
    557                                           command_argv[n][0], strerror(errno));
    558                                 } else {
    559                                     INFO("started command \"%s\": %s\n",
    560                                         command_argv[n][0], strerror(errno));
    561                                 }
     523                                execvp(command_argv[n][0], command_argv[n]);
    562524                            }
    563525                            _exit(errno);
     
    565527                    }
    566528                    _exit(EINVAL);
     529                 
    567530                } else {
    568531                    int c;
Note: See TracChangeset for help on using the changeset viewer.