Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #include "codespace.h"
25 #else //!__MSVCDOTNET__
28 #endif //__MSVCDOTNET__
30 Tracer::Tracer(MappedCodeSpace* aCodeSpace)
31 :iCodeSpace(aCodeSpace)
33 cout << "Thread trace\n\n";
34 cout << " Sample TID PC\n";
38 void Tracer::Sample(unsigned aNumber, const Thread& aThread, PC aPc)
40 if (aThread.iIndex >= iThreads.size())
41 iThreads.push_back(&aThread);
43 cout << dec << setw(7) << aNumber << ' ' << setw(3) << aThread.iIndex << " " << hex;
46 std::pair<const char*,PC> pc(iCodeSpace->Lookup(aPc));
49 cout << pc.first << " + " << pc.second << '\n';
53 cout << setw(8) << aPc << '\n';
58 void operator ()(const Thread* aThread)
60 cout << dec << setw(2) << aThread->iIndex << " " << *aThread << '\n';
64 void Tracer::Complete(unsigned, unsigned)
66 cout << "\n\nThreads:\n";
67 std::for_each(iThreads.begin(), iThreads.end(), PrintThread());