commsfwtools/commstools/utracedecoder/src/logevents/metatraceevent.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 09:22:25 +0200
changeset 0 dfb7c4ff071f
permissions -rw-r--r--
Revision: 200951 Kit: 200951

// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

#include <iostream>
#include <iomanip>
#include <math.h>

#include "utracedecoderapp.h"
#include "logevents\metatraceevent.h"
#include "e32btrace.h"

CMetaTraceEvent::CMetaTraceEvent(const CUTraceFrame& aFrame, MEventOutputHandler& aOutputHandler)
    : CTraceEventBase(aFrame, aOutputHandler)
    {
    SetPrefix("EMetaTrace");
    }

CMetaTraceEvent::CMetaTraceEvent(const CMultiPartFrameCollection& aFrameCollection, MEventOutputHandler& aOutputHandler)
    : CTraceEventBase(aFrameCollection, aOutputHandler)
    {
    SetPrefix("EMetaTrace");
    }

void CMetaTraceEvent::Describe(std::ostream& aOutput) const
    {
    int subcat = SubCategory();

    switch (subcat)
        {
        case BTrace::EMetaTraceTimestampsInfo:
			{
			int val = Arg1();
			int exponent = (signed char)(val>>24);
			int mantissa = val&0xffffff;
			double period1 = (double)mantissa * ::pow((double) 2, exponent);
			val = *((int*)Data() + 0);
			exponent = (signed char)(val>>24);
			mantissa = val&0xffffff;
			double period2 = (double)mantissa * ::pow((double) 2, exponent);
			int flags = *((int*)Data() + 1);
			CUTraceDecoderApp::SetTimestampPeriod((flags & 1)? CUTraceDecoderApp::E64Bit: CUTraceDecoderApp::ESplit, period1, period2);

            aOutput << std::noshowbase << std::nouppercase << std::hex
                << "Server Create: [DServer=0x" << std::setw(8) << std::setfill('0') << Arg1()
                << "] [Name=" << (Data() + 4)
                << "] ";
			}
            break;

		default:
			;
		}
	}