Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsTimeSampler Class Reference

List of all members.

Public Member Functions

 nsTimeSampler ()
void Reset ()
void StartTime ()
void EndTime ()
void AddTime (PRIntervalTime time)
PRIntervalTime LastInterval ()
char * PrintStats ()

Protected Attributes

PRIntervalTime mStartTime
double mSquares
double mTotalTime
PRUint32 mCount
PRIntervalTime mLastInterval

Detailed Description

Definition at line 59 of file TestFileInput2.cpp.


Constructor & Destructor Documentation

Definition at line 76 of file TestFileInput2.cpp.

{
    Reset();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 108 of file TestFileInput2.cpp.

{
    nsAutoCMonitor mon(this);
    mTotalTime += time;
    mSquares += (double)time * (double)time;
    mCount++;
}

Here is the caller graph for this function:

Definition at line 98 of file TestFileInput2.cpp.

{
    NS_ASSERTION(mStartTime != 0, "Forgot to call StartTime");
    PRIntervalTime endTime = PR_IntervalNow();
    mLastInterval = endTime - mStartTime;
    AddTime(mLastInterval);
    mStartTime = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 66 of file TestFileInput2.cpp.

{ return mLastInterval; }

Definition at line 117 of file TestFileInput2.cpp.

{
    double mean = mTotalTime / mCount;
    double variance = fabs(mSquares / mCount - mean * mean);
    double stddev = sqrt(variance);
    PRUint32 imean = (PRUint32)mean;
    PRUint32 istddev = (PRUint32)stddev;
    return PR_smprintf("%d +/- %d ms", 
                       PR_IntervalToMilliseconds(imean),
                       PR_IntervalToMilliseconds(istddev));
}

Here is the caller graph for this function:

Definition at line 82 of file TestFileInput2.cpp.

{
    mStartTime = 0;
    mSquares = 0;
    mTotalTime = 0;
    mCount = 0;
    mLastInterval = 0;
}

Here is the caller graph for this function:

Definition at line 92 of file TestFileInput2.cpp.

{
    mStartTime = PR_IntervalNow();
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 72 of file TestFileInput2.cpp.

Definition at line 73 of file TestFileInput2.cpp.

double nsTimeSampler::mSquares [protected]

Definition at line 70 of file TestFileInput2.cpp.

Definition at line 69 of file TestFileInput2.cpp.

double nsTimeSampler::mTotalTime [protected]

Definition at line 71 of file TestFileInput2.cpp.


The documentation for this class was generated from the following file: