kerneltest/e32utils/analyse/output.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "analyse.h"
       
    17 #include "output.h"
       
    18 #include "trace.h"
       
    19 
       
    20 #ifdef __MSVCDOTNET__
       
    21 #include <ostream>
       
    22 #include <iomanip>
       
    23 #else //!__MSVCDOTNET__
       
    24 #include <ostream.h>
       
    25 #include <iomanip.h>
       
    26 #endif //__MSVCDOTNET__
       
    27 
       
    28 ostream& operator<<(ostream& aStream, const Result& aSample)
       
    29 	{
       
    30 	if (!Analyse::Option(Analyse::EZeros) && aSample.iSamples == 0)
       
    31 		{
       
    32 		if (Analyse::Format() != Analyse::EExcel)
       
    33 			aStream << "       ";
       
    34 		}
       
    35 	else
       
    36 		{
       
    37 		switch (Analyse::Format())
       
    38 			{
       
    39 		case Analyse::ESamples:
       
    40 			aStream << setw(7) << aSample.iSamples;
       
    41 			break;
       
    42 		case Analyse::EPercent:
       
    43 			{
       
    44 			double sample = double(aSample.iSamples * 100) / double(aSample.iTotal);
       
    45 			aStream << setprecision(2) << setw(6) << setfill(' ') << sample << '%';
       
    46 			}
       
    47 			break;
       
    48 		case Analyse::EExcel:
       
    49 			{
       
    50 			double sample = double(aSample.iSamples) / double(aSample.iTotal);
       
    51 			aStream << setprecision(5) << sample;
       
    52 			}
       
    53 			break;
       
    54 			}
       
    55 		}
       
    56 	return aStream;
       
    57 	}
       
    58 
       
    59 ostream& operator<<(ostream& aStream, const Thread& aThread)
       
    60 	{
       
    61 	return aStream << aThread.iProcess->iName << "::" << aThread.iName;
       
    62 	}