Code example for Writer

Methods: sleep, write

0
        Log.v(TAG, "VSIZE = " + vsizevalue);
        return vsizevalue;
    } 
 
    public boolean validateMemoryResult (int startPid, int startMemory, Writer output) throws Exception {
        Thread.sleep(20000);
        mEndPid = getMediaserverPid();
        mEndMemory = getMediaserverVsize();
        output.write("Start Memory = " + startMemory + "\n");
        output.write("End Memory = " + mEndMemory + "\n");
        Log.v(TAG, "End memory :" + mEndMemory);
        //Write the total memory different into the output file 
        output.write("The total diff = " + (mEndMemory - startMemory));
        output.write("\n\n");
        //mediaserver crash 
        if (startPid != mEndPid){
            output.write("mediaserver died. Test failed\n");
            return false; 
        } 
        //memory leak greter than the tolerant 
        if ((mEndMemory - startMemory) > MAX_ACCEPTED_MEMORY_LEAK_KB )
            return false;