FileDocCategorySizeDatePackage
TraceUnits.javaAPI DocAndroid 1.5 API2449Wed May 06 22:41:10 BST 2009com.android.traceview

TraceUnits

public class TraceUnits extends Object

Fields Summary
private TimeScale
mTimeScale
private double
mScale
DecimalFormat
mFormatter
Constructors Summary
Methods Summary
public doublegetScaledValue(long value)


        
        return value * mScale;
    
public doublegetScaledValue(double value)

        return value * mScale;
    
public com.android.traceview.TraceUnits$TimeScalegetTimeScale()

        return mTimeScale;
    
public java.lang.Stringlabel()

        if (mScale == 1.0)
            return "usec";
        if (mScale == 0.001)
            return "msec";
        if (mScale == 0.000001)
            return "sec";
        return null;
    
public java.lang.StringlabelledString(double value)

        String units = label();
        String num = valueOf(value);
        return String.format("%s: %s", units, num);
    
public java.lang.StringlabelledString(long value)

        return labelledString((double) value);
    
public voidsetTimeScale(com.android.traceview.TraceUnits$TimeScale val)

        mTimeScale = val;
        switch (val) {
        case Seconds:
            mScale = 0.000001;
            break;
        case MilliSeconds:
            mScale = 0.001;
            break;
        case MicroSeconds:
            mScale = 1.0;
            break;
        }
    
public java.lang.StringvalueOf(long value)

        return valueOf((double) value);
    
public java.lang.StringvalueOf(double value)

        String pattern;
        double scaled = value * mScale;
        if ((int) scaled == scaled)
            pattern = "###,###";
        else
            pattern = "###,###.###";
        mFormatter.applyPattern(pattern);
        return mFormatter.format(scaled);