Changeset 955

Show
Ignore:
Timestamp:
10/22/06 15:06:39 (7 years ago)
Author:
leo
Message:
 
Location:
sandbox/trunk/pdp/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • sandbox/trunk/pdp/src/N-body.cpp

    r954 r955  
    196196                OPT_DISTRIBUTE, 
    197197                OPT_STEP, 
    198                 OPT_NUM_PARTICLE 
     198                OPT_NUM_PARTICLE, 
     199                OPT_LOGLEVEL 
    199200        }; 
    200201    OptionParser opt; 
     
    204205        opt.add(OptionWithArgument(OPT_STEP, "s", "step", "STEP", "num calculation steps (default = 100)")); 
    205206        opt.add(OptionWithArgument(OPT_NUM_PARTICLE, "p", "particle", "NUM", "num particles (default = 10)")); 
     207        opt.add(OptionWithArgument(OPT_LOGLEVEL, "w", "loglevel", "LOGLEVEL", "0:all, 1:trace, 2:debug, 3:info, 4:warn, 5:error, 6:fatal, 7:off)")); 
    206208 
    207209        try 
     
    217219                { 
    218220                        Logger::getRootLogger()->setLevel("trace"); 
     221                } 
     222                if(opt.isSet(OPT_LOGLEVEL)) 
     223                { 
     224                        int logLevel = Integer::parseInt(opt.getValue(OPT_LOGLEVEL)); 
     225                        Logger::getRootLogger()->setLevel(logLevel); 
    219226                } 
    220227 
  • sandbox/trunk/pdp/src/Replication.cpp

    r954 r955  
    6161                OPT_VERBOSE, 
    6262                OPT_REPLICATION_MODE, 
    63                 OPT_BUFFERSIZE 
     63                OPT_BUFFERSIZE, 
     64                OPT_LOGLEVEL 
    6465        }; 
    6566 
     
    7172                opt.add(OptionWithArgument(OPT_REPLICATION_MODE, "m", "replication", "MODE", " 0 (default) : one to N replication, 1 : chain replication")); 
    7273                opt.add(OptionWithArgument(OPT_BUFFERSIZE, "b", "buffer", "MBYTES", "buffer size (default: 16M)")); 
     74                opt.add(OptionWithArgument(OPT_LOGLEVEL, "w", "loglevel", "LOGLEVEL", "0:all, 1:trace, 2:debug, 3:info, 4:warn, 5:error, 6:fatal, 7:off)")); 
    7375 
    7476                opt.getContext(argc, argv); 
     
    8183                if(opt.getArgumentLength() < 1) 
    8284                        XERIAL_THROW(InvalidParameterException, "input file name must be given"); 
     85                if(opt.isSet(OPT_LOGLEVEL)) 
     86                { 
     87                        int logLevel = Integer::parseInt(opt.getValue(OPT_LOGLEVEL)); 
     88                        Logger::getRootLogger()->setLevel(logLevel); 
     89                } 
    8390 
    8491 
     
    234241                        MPI::INT.Unpack(&(packedDataBuffer[0]), 1, &incomingDataSize, 1, packedBufferPosition, comm); 
    235242                        XERIAL_DEBUG(_logger, "incoming bytes = " << incomingDataSize); 
    236                         //MPI::BYTE.Unpack(&(packedDataBuffer[0]), incomingDataSize, &(fileBuffer[0]), _bufferSize, packedBufferPosition, comm); 
    237                         size_t writesize = fwrite(&(packedDataBuffer[packedBufferPosition]), 1, incomingDataSize, file.getHandle()); 
     243                        MPI::BYTE.Unpack(&(packedDataBuffer[0]), incomingDataSize, &(fileBuffer[0]), _bufferSize, packedBufferPosition, comm); 
     244 
     245                        size_t writesize = fwrite(&(fileBuffer[0]), 1, incomingDataSize, file.getHandle()); 
    238246                        if(writesize != incomingDataSize) 
    239247                                XERIAL_THROW(Exception, "write failed. write size =  " << writesize);