예제 #1
0
int main (int argc, char* argv [])
{
    WbemExecCommand    command = WbemExecCommand ();
    int                rc;
    MessageLoader::setPegasusMsgHomeRelative(argv[0]);

#ifdef PEGASUS_OS_ZOS
    // for z/OS set stdout and stderr to EBCDIC
    setEBCDICEncoding(STDOUT_FILENO);
    setEBCDICEncoding(STDERR_FILENO);
#endif

    try
    {
        command.setCommand (argc, argv);
    }
    catch (const CommandFormatException& cfe)
    {
        cerr << WbemExecCommand::COMMAND_NAME << ": " << cfe.getMessage()
            << endl;

        MessageLoaderParms parms(ERR_USAGE_KEY,ERR_USAGE);
        parms.msg_src_path = MSG_PATH;
        cerr << WbemExecCommand::COMMAND_NAME <<
            ": " << MessageLoader::getMessage(parms) << endl;

        exit (Command::RC_ERROR);
    }

    rc = command.execute (cout, cerr);
    exit (rc);
    return 0;
}
예제 #2
0
int main(int argc, char** argv)
{
    String pegasusHome;
    Boolean shutdownOption = false;
    Boolean debugOutputOption = false;

    // Set Message loading to process locale
    MessageLoader::_useProcessLocale = true;

#ifdef PEGASUS_OS_ZOS
    // Direct standard input to /dev/null,
    close(STDIN_FILENO);
    open("/dev/null", O_RDONLY);

    if ( setEBCDICEncoding(STDOUT_FILENO)==-1 ||
         setEBCDICEncoding(STDERR_FILENO)==-1 )
    {
       PEG_TRACE_CSTRING(TRC_SERVER,Tracer::LEVEL1,
           "Coud not set stdout or stderr to EBCDIC encoding.");
    }
    // Need to initialize timezone information in the
    // initial processing thread (IPT)
    initialize_zOS_timezone();
#endif

#if defined(PEGASUS_OS_AIX) && defined(PEGASUS_HAS_MESSAGES)
    setlocale(LC_ALL, "");
#endif

#ifndef PEGASUS_OS_TYPE_WINDOWS
    //
    // Get environment variables:
    //
# if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS)
    pegasusHome = AIX_RELEASE_PEGASUS_HOME;
# elif defined(PEGASUS_OS_PASE)
    const char *tmp = getenv("PEGASUS_HOME");
    pegasusHome = (tmp == 0) ? PASE_DEFAULT_PEGASUS_HOME : tmp;
# elif !defined(PEGASUS_USE_RELEASE_DIRS) || \
    defined(PEGASUS_OS_ZOS)
    const char* tmp = getenv("PEGASUS_HOME");

    if (tmp)
    {
        pegasusHome = tmp;
    }
# endif

    FileSystem::translateSlashes(pegasusHome);
#else

    // windows only
    //setHome(pegasusHome);
    pegasusHome = _cimServerProcess->getHome();
#endif

#ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION

    // If invoked with "--executor-socket <socket>" option, then use executor.

    Executor::setSock(_extractExecutorSockOpt(argc, argv));

    // Ping executor to verify the specified socket is valid.

    if (Executor::ping() != 0)
    {
        MessageLoaderParms parms("src.Server.cimserver.EXECUTOR_PING_FAILED",
            "Failed to ping the executor on the specified socket.");
        cerr << argv[0] << ": " << MessageLoader::getMessage(parms) << endl;
        exit(1);
    }

#endif /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */

        // Get help, version, status and shutdown options

        for (int i = 1; i < argc; )
        {
            const char* arg = argv[i];
            if (strcmp(arg, "--help") == 0)
            {
                PrintHelp(argv[0]);
                Executor::daemonizeExecutor();
                exit(0);
            }
            if (strcmp(arg, "--status") == 0)
            {
                int retValue = 0;
                if (_serverRunStatus.isServerRunning())
                {
                    MessageLoaderParms parms(
                        "src.Server.cimserver.CIMSERVER_RUNNING",
                        "The CIM Server is running.");
                    cout << MessageLoader::getMessage(parms) << endl;
                }
                else
                {
                    MessageLoaderParms parms(
                        "src.Server.cimserver.CIMSERVER_NOT_RUNNING",
                        "The CIM Server is not running.");
                    cout << MessageLoader::getMessage(parms) << endl;
                    retValue = 2;
                }
                Executor::daemonizeExecutor();
                exit(retValue);
            }
            else if (strcmp(arg, "--version") == 0)
            {
                cout << _cimServerProcess->getCompleteVersion() << endl;
                Executor::daemonizeExecutor();
                exit(0);
            }
            // Check for -option
            else if (*arg == '-')
            {
                // Get the option
                const char* option = arg + 1;

                //
                // Check to see if user asked for the version (-v option):
                //
                if (*option == OPTION_VERSION &&
                    strlen(option) == 1)
                {
                    cout << _cimServerProcess->getCompleteVersion() << endl;
                    Executor::daemonizeExecutor();
                    exit(0);
                }
                //
                // Check to see if user asked for help (-h option):
                //
                else if (*option == OPTION_HELP &&
                        (strlen(option) == 1))
                {
                    PrintHelp(argv[0]);
                    Executor::daemonizeExecutor();
                    exit(0);
                }
#if !defined(PEGASUS_USE_RELEASE_DIRS)
                else if (*option == OPTION_HOME &&
                        (strlen(option) == 1))
                {
                    if (i + 1 < argc)
                    {
                        pegasusHome.assign(argv[i + 1]);
                    }
                    else
                    {
                        String opt(option);
                        MessageLoaderParms parms(
                            "src.Server.cimserver.MISSING_ARGUMENT",
                            "Missing argument for option -$0",
                            opt);
                        cout << MessageLoader::getMessage(parms) << endl;
                        exit(1);
                    }

                    memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
                    argc -= 2;
                }
#endif
                //
                // Check to see if user asked for debug output (-X option):
                //
                else if (*option == OPTION_DEBUGOUTPUT &&
                        (strlen(option) == 1))
                {
                    MessageLoaderParms parms(
                        "src.Server.cimserver.UNSUPPORTED_DEBUG_OPTION",
                        "Unsupported debug output option is enabled.");
                    cout << MessageLoader::getMessage(parms) << endl;

                    debugOutputOption = true;

#if defined(PEGASUS_OS_HPUX)
                    System::bindVerbose = true;
#endif

                    // remove the option from the command line
                    memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
                    argc--;
                }
                //
                // Check to see if user asked for shutdown (-s option):
                //
                else if (*option == OPTION_SHUTDOWN &&
                        (strlen(option) == 1))
                {
                    //
                    // Check to see if shutdown has already been specified:
                    //
                    if (shutdownOption)
                    {
                        MessageLoaderParms parms(
                            "src.Server.cimserver.DUPLICATE_SHUTDOWN_OPTION",
                            "Duplicate shutdown option specified.");

                        cout << MessageLoader::getMessage(parms) << endl;
                        exit(1);
                    }

                    shutdownOption = true;

                    // remove the option from the command line
                    memmove(&argv[i], &argv[i + 1], (argc-i) * sizeof(char*));
                    argc--;
                }
                else
                    i++;
            }
            else
                i++;
        }

    //
    // Set the value for pegasusHome property
    //
    ConfigManager::setPegasusHome(pegasusHome);

    //
    // Do the platform specific run
    //

    return _cimServerProcess->platform_run(
        argc, argv, shutdownOption, debugOutputOption);
}
예제 #3
0
int main(int argc, char** argv)
{
    const char* arg0 = System::findBaseName(argv[0]);

#ifdef PEGASUS_OS_ZOS
    // for z/OS set stdout and stderr to EBCDIC
    setEBCDICEncoding(STDOUT_FILENO);
    setEBCDICEncoding(STDERR_FILENO);
#endif
 
#ifdef PEGASUS_OS_PASE
    // Allow user group name larger than 8 chars in PASE environemnt
    setenv("PASE_USRGRP_LIMITED","N",1);
#endif
    // If no arguments, simply print usage message and terminate.
    MessageLoader::_useProcessLocale = true;

    if (argc == 1)
    {
        showUsage();
        exit(0);
    }

    //****** Show the args diagnostic display
    if (strcmp(argv[1],"displayargs") == 0)
    {
        cout << "argc = " << argc << endl;
        for (int i = 0; i < argc; i++)
            cout << "argv[" << i << "] = " << argv[i] << endl;
    }

    // Get options (from command line and from configuration file); this
    // removes corresponding options and their arguments from the command
    // line.
    OptionManager om;
    Options opts;
    try
    {
        // assume that the config file is local to directory where called.
        String testHome = ".";
        om.setMessagePath("pegasus/pegasusCLI");
        GetOptions(om, argc, argv, testHome);

        // Initialize all of the function input parameters.
        opts.location =  String::EMPTY;
#ifdef PEGASUS_HAS_SSL
        opts.ssl = false;
        opts.clientCert = String::EMPTY;
        opts.clientKey = String::EMPTY;
#endif
        opts.nameSpace = "root/cimv2";
        opts.cimCmd = "unknown";
        opts.className = CIMName();
        opts.objectName = "unknown";

        opts.isXmlOutput = false;
        opts.outputFormatType = OUTPUT_MOF;
        opts.user = String::EMPTY;
        opts.password = String::EMPTY;
        opts.verboseTest = false;

        opts.localOnly = true;
        opts.deepInheritance = false;
        opts.includeQualifiers = true;
        opts.includeClassOrigin = false;
        opts.assocClassName = String::EMPTY;
        opts.assocClass = CIMName();
        opts.resultClassName = String::EMPTY;
        opts.resultClass = CIMName();
        opts.role = String::EMPTY;
        opts.resultRole = String::EMPTY;
        opts.propertyListText = String::EMPTY;
        opts.propertyList.clear();
        opts.propertyName = String::EMPTY;
        opts.methodName = CIMName("unknown");
        opts.delay = 0;
        opts.trace = 0;
        opts.count= 97832;
        opts.repeat = 0;
        opts.time = false;
        opts.termCondition = 0;
        opts.debug = false;
        opts.queryLanguage = "WQL";

        // move any other input parameters left to the extraParams List
        CheckCommonOptionValues(om, argv, opts);

        /* note that this is in error since it assumes a fixed
           number of parameters will be used for all of the commands
           It needs to be expanded to allow for a variable minimum
           number of commands before it picks up any extras
        */
        if (argc > 2)
        {
            for (int i = 2 ; i < argc ; i++ )
                opts.extraParams.append(argv[i]);
        }
    }

    catch(CIMException& e)
    {
        cerr << argv[0] << " Caught CIMException during init: "
             << "\n" << e.getMessage()
             << endl;
        exit(1);
    }

    catch (Exception& e)
    {
        cerr << argv[0] << ": " << e.getMessage() << endl;
        exit(1);
    }
    catch(...)
    {
        cerr << argv[0] << " Caught General Exception During Init:" << endl;
        exit(1);
    }

    // if there is still an arg1, assume it is the command name.
    if (argc > 1)
    {
        opts.cimCmd = argv[1];
    }
    else
    {
        cout << " Command name must be first parameter or --c parameter."
            << " \n  ex. " << argv[0] <<  " enumerateclasses\n"
            << "Enter " << argv[0] << " -h for help."
            << endl;
        exit(1);
    }

    // if the trace option was set initialize the trace function.
    if (opts.trace != 0)
    {
        const char* tmpDir = getenv ("PEGASUS_TMP");
            if (tmpDir == NULL)
            {
                tmpDir = ".";
            }
            String traceFile (tmpDir);
            traceFile.append("/cliTrace.trc");
            Tracer::setTraceFile (traceFile.getCString());
            Tracer::setTraceComponents("ALL");
            Tracer::setTraceLevel(opts.trace);
    }

    // Find the command and save index in cmdIndex
    Uint32 cmdIndex = 0;
    
    if (opts.verboseTest && opts.debug)
        cout << "TEST Command = " << opts.cimCmd << endl;

    // Find the command or the short cut name
    for( ; cmdIndex < NUM_COMMANDS; cmdIndex++ )
    {
        if ((String::equalNoCase(opts.cimCmd, 
                CommandTable[cmdIndex].CommandName)) 
                ||
                (opts.cimCmd == CommandTable[cmdIndex].ShortCut))
            // Break if found
                    break;
    }

    Stopwatch totalElapsedExecutionTime;

    totalElapsedExecutionTime.start();

    // Now try to open the connection to the cim server
    CIMClient client;
    try
    {
        if (CommandTable[cmdIndex].ID_Command != ID_ShowOptions)
        {
            String host;
            HostLocator addr;
            if (opts.location != String::EMPTY)
            { 
                addr.setHostLocator(opts.location);
                if (!addr.isValid())
                {
                    throw InvalidLocatorException(opts.location);
                }
                host = addr.getHost();
            } 

            Uint32 portNumber = System::lookupPort( WBEM_HTTP_SERVICE_NAME,
                              WBEM_DEFAULT_HTTP_PORT );

            // Set up SSL port and flag for verbose display
            // if SSL included in build
            String useSSL;
#ifdef PEGASUS_HAS_SSL
            if (opts.ssl)
            {
                portNumber = System::lookupPort( WBEM_HTTPS_SERVICE_NAME,
                              WBEM_DEFAULT_HTTPS_PORT );
            }
            useSSL = " ssl=";
            useSSL.append((opts.ssl)? "true" : "false");
#endif

            if (host != String::EMPTY && addr.isPortSpecified())
            {
                portNumber = addr.getPort();
            }

            //check whether we should use connect() or connectLocal()
            //an empty location option indicates to use connectLocal()
            if (String::equal(host, String::EMPTY))
            {
                if (opts.verboseTest)
                {
                    cout << "Connect with connectLocal" << endl;
                }
                client.connectLocal();

            }
            else
            {
                if (opts.verboseTest)
                {
                    cout << "Connect to " << host
                        << " port=" << portNumber
                        << useSSL
                         << " for User="******"SSL options " 
                                << "Cert = " << opts.clientCert
                                << "clientKey = "  << opts.clientKey << endl;
                        }
                        client.connect(host,
                                       portNumber,
                                       SSLContext("", 
                                           opts.clientCert, 
                                           opts.clientKey,
                                           NULL, "ssl.rnd"),
                                       opts.user,
                                       opts.password);
                    } else
                    {
                        client.connect(host,
                                       portNumber,
                                       SSLContext("", NULL, "ssl.rnd"),
                                       opts.user,
                                       opts.password);
                    }
                } else //connect over HTTP
                {
                    client.connect(host, portNumber, opts.user, opts.password);
                }
#else
                client.connect(host, portNumber, opts.user, opts.password);
#endif
            }
        }
    }    
    catch(Exception &e)
    {
        cerr << "Pegasus Exception: " << e.getMessage() <<
              " Trying to connect to " << opts.location << endl;
        exit(1);
    }

    // Register for Client statistics.
    ClientStatistics statistics = ClientStatistics();
    client.registerClientOpPerformanceDataHandler(statistics);

    if (opts.delay != 0)
    {
        // This was a test because of some delay caused problems.
        Threads::sleep(opts.delay * 1000);
    }

    // If the timeout is not zero, set the timeout for this connection.
    if (opts.connectionTimeout != 0)
    {
        client.setTimeout(opts.connectionTimeout * 1000);
    }

    // Save the total connect time.
    double totalConnectTime = opts.elapsedTime.getElapsed();

    double totalTime = 0;
    Uint32 repeatCount = opts.repeat;
    double maxTime = 0;
    double minTime = 10000000;

    Uint64 serverTotalTime = 0;
    Uint64 maxServerTime = 0;
    Uint64 minServerTime = 10000000;

    Uint64 rtTotalTime = 0;
    Uint64 maxRtTime = 0;
    Uint64 minRtTime = 10000000;

    // Process the input command within a try block.
    try
    {
        // Loop to repeat the command a number of times.
        do
        {
            // or exit with error through default of case logic
            switch(CommandTable[cmdIndex].ID_Command)
                {
                case ID_EnumerateInstanceNames :
                    if (!_getClassNameInput(argc, argv, opts, true))
                        exit(1);
                    enumerateInstanceNames(client, opts);
                    break;

                case ID_EnumerateAllInstanceNames :
                    if (!_getClassNameInput(argc, argv, opts, false))
                        exit(1);
                    enumerateAllInstanceNames(client, opts);
                    break;

                case ID_EnumerateInstances :
                    if (!_getClassNameInput(argc, argv, opts, true))
                        exit(1);
                    enumerateInstances(client, opts);
                    break;
                case ID_GetInstance :
                    if (!_getObjectNameInput(argc, argv, opts, true))
                        exit(1);
                    getInstance(client, opts);
                    break;

                case ID_EnumerateClassNames :
                    if (!_getClassNameInput(argc, argv, opts, false))
                        exit(1);
                    enumerateClassNames(client, opts);
                    break;

                case ID_EnumerateClasses :
                    if (!_getClassNameInput(argc, argv, opts, false))
                        exit(1);
                    enumerateClasses(client, opts);
                    break;

                case ID_GetClass :
                    if (!_getClassNameInput(argc, argv, opts, true))
                        exit(1);
                    getClass(client, opts);
                    break;

                case ID_CreateInstance :
                    if (!_getClassNameInput(argc, argv, opts, true))
                        exit(1);
                    createInstance(client, opts);
                    break;

                case ID_DeleteInstance :
                    if (!_getObjectNameInput(argc, argv, opts, true))
                        exit(1);
                    deleteInstance(client, opts);
                    break;

                case ID_CreateClass :
                    cerr << "CreateClass not implemented" << endl;
                    break;

                case ID_DeleteClass :
                    if (!_getClassNameInput(argc, argv, opts, true))
                        exit(1);
                    deleteClass(client, opts);
                    break;

                case ID_GetProperty :
                    if (argc != 4)
                    {
                        cout << "Usage: " << arg0 <<
                            " getproperty <instancename> <propertyname>" << 
                            endl;
                        exit(1);
                    }

                    opts.instanceName = argv[2];
                    opts.inputObjectName = argv[2];
                    opts.propertyName = argv[3];

                    getProperty(client, opts);
                    break;

                case ID_SetProperty :
                    if (argc != 5)
                        cout <<"Usage: " << arg0 << 
                          " setproperty instancename propertyname value "
                           << endl;
                    setProperty(client, opts);
                    break;

                case ID_EnumerateQualifiers :
                    enumerateQualifiers(client, opts);
                    break;

                case ID_SetQualifier :
                    cerr << "SetQualifer not implemented" << endl;
                        exit(1);
                    break;

                case ID_GetQualifier :
                    if (!_getQualifierNameInput(argc, argv, opts))
                        exit(1);
                    getQualifier(client, opts);
                    break;

                case ID_DeleteQualifier :
                    if (!_getQualifierNameInput(argc, argv, opts))
                        exit(1);
                    deleteQualifier(client, opts);
                    break;

                /* Reference params are
                    [IN] <objectName> ObjectName,
                    [IN,OPTIONAL,NULL] <className> ResultClass = NULL,
                    [IN,OPTIONAL,NULL] string Role = NULL,
                    [IN,OPTIONAL] boolean IncludeQualifiers = false,
                    [IN,OPTIONAL] boolean IncludeClassOrigin = false,
                    [IN,OPTIONAL,NULL] string PropertyList [] = NULL
                */
                case ID_References  :
                    if (!_getObjectNameInput(argc, argv, opts, true))
                        exit(1);
                    references(client, opts);
                    break;

                case ID_ReferenceNames :
                    if (!_getObjectNameInput(argc, argv, opts, true))
                        exit(1);
                    referenceNames(client, opts);
                    break;

                case ID_Associators :
                    if (!_getObjectNameInput(argc, argv, opts, true))
                        exit(1);
                    associators(client, opts);
                    break;

                case ID_AssociatorNames :
                    if (!_getObjectNameInput(argc, argv, opts, true))
                        exit(1);
                    associatorNames(client,opts);
                    break;

                case ID_EnumerateNamespaces :
                    // Note that the following constants are fixed here.  We
                    // should be getting them from the environment to assure
                    // that others know that we are using them.
                    opts.className = CIMName("CIM_Namespace");
                    if (argc > 2)
                    {
                        opts.nameSpace = argv[2];
                        opts.inputObjectName = argv[2];
                    }
                    else
                        // set nameSpace to interop namespace name
                        opts.nameSpace = 
                            PEGASUS_NAMESPACENAME_INTEROP.getString();

                    enumerateNamespaces_Namespace(client,opts);
                    break;

                    /*
                        CIMValue invokeMethod(
                            const CIMNamespaceName& nameSpace,
                            const CIMObjectPath& instanceName,
                            const CIMName& methodName,
                            const Array<CIMParamValue>& inParameters,

                    Array<CIMParamValue>& outParameters
                    */
                case ID_InvokeMethod :
                    if (argc < 4)
                    {
                        cout << "Usage: InvokeMethod requires that object and"
                            " method names be specified.\n"
                            "Input parameters are optional and can be"
                            " specified with the -ip option or as"
                            " additional parameters to this call. "
                            "Enter each input parameter as name=value"
                            " (no spaces around equal sign)."
                            << endl;
                        exit(1);
                    }
                    opts.objectName = argv[2];
                    opts.inputObjectName = argv[2];
                    opts.methodName = CIMName(argv[3]);

                    // If there are any extra arguments they must be parameters
                    // These parameters  can be used in addtion to parameters
                    // ifrom the -ip option setting. Parameters found here must
                    // be key=value pairs or they will generate an exception.
                    if (argc > 4)
                    {
                        // get input params from command line
                        for (Sint32 i = 4 ; i < argc; i++)
                        {
                            CIMParamValue pv;
                            String s = argv[i];
                            pv = _createMethodParamValue(s, opts);
                            opts.inParams.append(pv);
                        }
                    }
                    invokeMethod(client, opts);
                    break;

                case ID_ShowOptions :
                    showUsage();
                    break;

                case ID_ExecQuery:
                    opts.query = argv[2];
                    if (argc==4)
                        opts.queryLanguage = argv[3];
                    executeQuery(client, opts);
                    break;

                case ID_StatisticsOn:
                    setObjectManagerStatistics(client, true);
                    break;

                case ID_StatisticsOff:
                    setObjectManagerStatistics(client, false);
                    break;

                //case ID_Unknown :
                default:
                    cout << "Invalid Command. Command name must be first parm"
                            " or --c parameter."
                        << " \n  ex. " << arg0 << " enumerateclasses\n"
                        << "Enter " << argv[0] << " -h for help."
                        << endl;
                    exit(1);
                    break;
            }
            if (opts.repeat > 0)
            {
                if (opts.verboseTest)
                {
                    cout << "Repetitition " << opts.repeat << endl;
                }
                opts.repeat--;
                if (opts.time)
                {
                    totalTime += opts.saveElapsedTime;
                    maxTime = LOCAL_MAX(maxTime, opts.saveElapsedTime);
                    minTime = LOCAL_MIN(minTime, opts.saveElapsedTime);
                    rtTotalTime += (returnedPerformanceData.roundTripTime);
                    maxRtTime = LOCAL_MAX(maxRtTime,
                            returnedPerformanceData.roundTripTime);
                    minRtTime = LOCAL_MIN(minRtTime,
                            returnedPerformanceData.roundTripTime);

                    if (returnedPerformanceData.serverTimeKnown)
                    {
                        serverTotalTime += (returnedPerformanceData.serverTime);
                        maxServerTime = LOCAL_MAX(maxServerTime,
                                returnedPerformanceData.serverTime);
                        minServerTime = LOCAL_MIN(minServerTime,
                                returnedPerformanceData.serverTime);
                    }
                }
            }
        } while (opts.repeat > 0  );

        if (opts.time)
        {
            if (repeatCount == 0)
            {
                cout << CommandTable[cmdIndex].CommandName
                    << " "
                    << opts.inputObjectName
                    << " Time= "
                    << opts.saveElapsedTime
                    << " Sec "
                    << " SvrTime= "
                    << CIMValue(returnedPerformanceData.serverTime).toString()
                    << " us "
                    << " RtTime= "
                    << CIMValue(returnedPerformanceData.roundTripTime).
                           toString()
                    << " us "
                    << "Req size= "
                    << CIMValue(returnedPerformanceData.requestSize).toString()
                    << " b Resp size= "
                    << CIMValue(returnedPerformanceData.responseSize).toString()
                    << " b"
                    << endl;
            }
            else
            {
                cout << CommandTable[cmdIndex].CommandName
                    << " "
                    << opts.inputObjectName
                    << " Total Time "
                    << totalTime
                    << " for "
                    << repeatCount
                    << " ops. Avg= "
                    << (totalTime * 1000000)/repeatCount
                    << " us min= "
                    << minTime * 1000000
                    << " us max= "
                    << (maxTime * 1000000) 
                    << " us SvrTime avg= "
                    << CIMValue(serverTotalTime/repeatCount).toString()
                    << " us SvrTime min= "
                    << CIMValue(minServerTime).toString()
                    << " us SvrTime max= "
                    << CIMValue(maxServerTime).toString()
                    << " us"
                    << " RtTime avg= "
                    << CIMValue(rtTotalTime/repeatCount).toString()
                    << " us RtTime min= "
                    << CIMValue(minRtTime).toString()
                    << " us RtTime max= "
                    << CIMValue(maxRtTime).toString()
                    << " us"
                    << endl;
            }
        }
    }
    catch(CIMException& e)
    {
        cerr << argv[0] << " CIMException: "<<" Cmd= " << opts.cimCmd
            << " Object= " << opts.inputObjectName
             << "\n" << e.getMessage()
             << endl;
        opts.termCondition = 1;
    }
    catch(Exception& e)
    {
        PEGASUS_STD(cerr) << argv[0] << " Pegasus Exception: " << e.getMessage()
                <<  ". Cmd = " << opts.cimCmd 
                << " Object = " << opts.inputObjectName
                << PEGASUS_STD(endl);
            opts.termCondition = 1;
    }
    catch(...)
    {
        cerr << argv[0] << " Caught General Exception:" << endl;
        opts.termCondition = 1;
    }

    totalElapsedExecutionTime.stop();

    if (opts.time)
    {
        // if abnormal term, dump all times
        if (opts.termCondition == 1)
        {
            cout << "Exception" << endl;
            cout << "Prev Time " << opts.saveElapsedTime << " Sec" << endl;
            opts.saveElapsedTime = opts.elapsedTime.getElapsed();
            cout << "Last Time " << opts.saveElapsedTime << " Sec" << endl;
            cout << "Total Time " << totalTime << " for "
                << repeatCount << " operations. Avg.= " << totalTime/repeatCount
                << " min= " << minTime << " max= " << maxTime << endl;
        }

        cout << "Total Elapsed Time= " << totalElapsedExecutionTime.getElapsed()
             << " Sec. Terminated at " << System::getCurrentASCIITime() << endl;
    }
    if (opts.delay != 0)
    {
        Threads::sleep(opts.delay * 1000);
    }
    return(opts.termCondition);
}