public String toPerformanceString() {
        final StringBuilder res = 
                new StringBuilder()
                    .append(
                            quote(metric.getMetricName()))
                            .append('=')
                            .append((metric.getMetricValue(prefix)).toPrettyPrintedString());

        if (unitOfMeasure != null) {
            switch (unitOfMeasure) {
            case milliseconds:
                res.append("ms");
                break;
            case microseconds:
                res.append("us");
                break;
            case seconds:
                res.append('s');
                break;
            case bytes:
                res.append('B');
                break;
            case kilobytes:
                res.append("KB");
                break;
            case megabytes:
                res.append("MB");
                break;
            case gigabytes:
                res.append("GB");
                break;
            case terabytes:
                res.append("TB");
                break;
            case percentage:
                res.append('%');
                break;
            case counter:
                res.append('c');
                break;
            default:
            }
        }

        if (unit != null) {
            res.append(unit);
        }

        res.append(';');
        if (warningRange != null) {
            res.append(warningRange);
        }
        res.append(';');
        if (criticalRange != null) {
            res.append(criticalRange);
        }
        res.append(';');
        if (metric.getMinValue() != null) {
            res.append(metric.getMinValue(prefix).toPrettyPrintedString());
        }
        res.append(';');
        if (metric.getMaxValue() != null) {
            res.append(metric.getMaxValue(prefix).toPrettyPrintedString());
        }

        while (res.charAt(res.length() - 1) == ';') {
            res.deleteCharAt(res.length() - 1);
        }

        return res.toString();
    }
public String toPerformanceString ( ) { final StringBuilder res = new StringBuilder ( ) . append ( quote ( metric . getMetricName ( ) ) ) . append ( '=' ) . append ( ( metric . getMetricValue ( prefix ) ) . toPrettyPrintedString ( ) ) ; if ( unitOfMeasure != null ) { switch ( unitOfMeasure ) { case milliseconds : res . append ( "ms" ) ; break ; case microseconds : res . append ( "us" ) ; break ; case seconds : res . append ( 's' ) ; break ; case bytes : res . append ( 'B' ) ; break ; case kilobytes : res . append ( "KB" ) ; break ; case megabytes : res . append ( "MB" ) ; break ; case gigabytes : res . append ( "GB" ) ; break ; case terabytes : res . append ( "TB" ) ; break ; case percentage : res . append ( '%' ) ; break ; case counter : res . append ( 'c' ) ; break ; default : } } if ( unit != null ) { res . append ( unit ) ; } res . append ( ';' ) ; if ( warningRange != null ) { res . append ( warningRange ) ; } res . append ( ';' ) ; if ( criticalRange != null ) { res . append ( criticalRange ) ; } res . append ( ';' ) ; if ( metric . getMinValue ( ) != null ) { res . append ( metric . getMinValue ( prefix ) . toPrettyPrintedString ( ) ) ; } res . append ( ';' ) ; if ( metric . getMaxValue ( ) != null ) { res . append ( metric . getMaxValue ( prefix ) . toPrettyPrintedString ( ) ) ; } while ( res . charAt ( res . length ( ) - 1 ) == ';' ) { res . deleteCharAt ( res . length ( ) - 1 ) ; } return res . toString ( ) ; }
Produce a performance string according to Nagios specification based on
the value of this performance data object.

@return a string that can be returned to Nagios