os/kernelhwsrv/kerneltest/e32utils/analyse/output.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 	}