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