src/windows/native/sun/management/OperatingSystemImpl.c
static int
initSingleCounterQuery(SingleCounterQueryP counterQuery, char *counterString) {
    if (PdhOpenQuery_i(NULL, 0, &counterQuery->query.query) != ERROR_SUCCESS) {
        /* printf("Could not open query for %s", counterString); */
        return -1;
    }
    if (PdhAddCounter_i(counterQuery->query.query, counterString, 0, &counterQuery->counter) != ERROR_SUCCESS) {
        /* printf("Could not add counter %s for query", counterString); */
        if (counterQuery->counter != NULL) {
            PdhRemoveCounter_i(counterQuery->counter);
        }
        if (counterQuery->query.query != NULL) {
            PdhCloseQuery_i(counterQuery->query.query);
        }
        memset(counterQuery, 0, sizeof(SingleCounterQueryS));
        return -1;
    }
    return CONFIG_SUCCESSFUL;
}
/**
 * Sets up the supplied SingleCounterQuery to listen for the specified counter.
 * initPDH() must have been run prior to calling this function!
 *
 * @param counterQuery   the counter query to set up.
 * @param counterString  the string specifying the path to the counter.
 * @param ebuf           the error buffer.
 * @param elen           the length of the error buffer.
 * @returns              CONFIG_SUCCESSFUL if successful, negative on failure.
 */
Sets up the supplied SingleCounterQuery to listen for the specified counter.
initPDH() must have been run prior to calling this function!

@param counterQuery   the counter query to set up.
@param counterString  the string specifying the path to the counter.
@param ebuf           the error buffer.
@param elen           the length of the error buffer.
@returns              CONFIG_SUCCESSFUL if successful, negative on failure.
Sets up the supplied SingleCounterQuery to listen for the specified counter . initPDH () must have been run prior to calling this function! @param counterQuery the counter query to set up . @param counterString the string specifying the path to the counter . @param ebuf the error buffer . @param elen the length of the error buffer . @returns CONFIG_SUCCESSFUL if successful negative on failure .
static int
initSingleCounterQuery(SingleCounterQueryP counterQuery, char *counterString) {
    if (PdhOpenQuery_i(NULL, 0, &counterQuery->query.query) != ERROR_SUCCESS) {
        return -1;
    }
    if (PdhAddCounter_i(counterQuery->query.query, counterString, 0, &counterQuery->counter) != ERROR_SUCCESS) {
        if (counterQuery->counter != NULL) {
            PdhRemoveCounter_i(counterQuery->counter);
        }
        if (counterQuery->query.query != NULL) {
            PdhCloseQuery_i(counterQuery->query.query);
        }
        memset(counterQuery, 0, sizeof(SingleCounterQueryS));
        return -1;
    }
    return CONFIG_SUCCESSFUL;
}
static int initSingleCounterQuery ( SingleCounterQueryP counterQuery , char * counterString ) { if ( PdhOpenQuery_i ( NULL , 0 , & counterQuery -> query . query ) != ERROR_SUCCESS ) { return -1 ; } if ( PdhAddCounter_i ( counterQuery -> query . query , counterString , 0 , & counterQuery -> counter ) != ERROR_SUCCESS ) { if ( counterQuery -> counter != NULL ) { PdhRemoveCounter_i ( counterQuery -> counter ) ; } if ( counterQuery -> query . query != NULL ) { PdhCloseQuery_i ( counterQuery -> query . query ) ; } memset ( counterQuery , 0 , sizeof ( SingleCounterQueryS ) ) ; return -1 ; } return CONFIG_SUCCESSFUL ; }
Sets up the supplied SingleCounterQuery to listen for the specified counter.
Sets up the supplied SingleCounterQuery to listen for the specified counter .
/* printf("Could not open query for %s", counterString); */ /* printf("Could not add counter %s for query", counterString); */