os/kernelhwsrv/kerneltest/e32test/bench/t_exec.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.
sl@0
     1
// Copyright (c) 1995-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
// e32test\bench\t_exec.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32test.h>
sl@0
    19
sl@0
    20
const TInt KHeapSize=0x2000;
sl@0
    21
const TInt KMajorVersionNumber=1;
sl@0
    22
const TInt KMinorVersionNumber=0;
sl@0
    23
const TInt KBuildVersionNumber=1;
sl@0
    24
sl@0
    25
LOCAL_D RTest test(_L("T_EXEC"));
sl@0
    26
LOCAL_D RTest testSvr(_L("Server"));
sl@0
    27
LOCAL_D RSemaphore semmy;
sl@0
    28
LOCAL_D TInt speedCount;
sl@0
    29
sl@0
    30
LOCAL_C TInt speedyThreadEntryPoint(TAny*)
sl@0
    31
//
sl@0
    32
// The entry point for the speed test thread.
sl@0
    33
//
sl@0
    34
	{
sl@0
    35
sl@0
    36
	speedCount=0;
sl@0
    37
	semmy.Signal();
sl@0
    38
	TUint myChar='a';
sl@0
    39
	TUint r;
sl@0
    40
	for (TUint i=0;i<0xffffffff;i++)
sl@0
    41
		{
sl@0
    42
		r=User::UpperCase(myChar);
sl@0
    43
		speedCount++;
sl@0
    44
		}
sl@0
    45
	return(KErrNone);
sl@0
    46
	}
sl@0
    47
sl@0
    48
GLDEF_C TInt E32Main()
sl@0
    49
//
sl@0
    50
// Test timers.
sl@0
    51
//
sl@0
    52
    {
sl@0
    53
sl@0
    54
	test.Title();
sl@0
    55
	test.Start(_L("Creating semaphore"));
sl@0
    56
	TInt r=semmy.CreateLocal(0);
sl@0
    57
	test(r==KErrNone);
sl@0
    58
//
sl@0
    59
	test.Next(_L("Starting speedy thread"));
sl@0
    60
	RThread speedy;
sl@0
    61
	r=speedy.Create(_L("Speedy"),speedyThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
sl@0
    62
	test(r==KErrNone);
sl@0
    63
	speedy.Resume();
sl@0
    64
//
sl@0
    65
	test.Next(_L("Wait for speedy to start"));
sl@0
    66
	semmy.Wait();
sl@0
    67
//
sl@0
    68
	test.Printf(_L("Starting exec speed test...\n"));
sl@0
    69
	User::After(0);
sl@0
    70
	TInt b=speedCount;
sl@0
    71
	User::After(1000000);
sl@0
    72
	TInt n=speedCount;
sl@0
    73
	test.Printf(_L("Count = %d exec calls in 1 second\n"),n-b);
sl@0
    74
//
sl@0
    75
	test.Next(_L("Kill speedy"));
sl@0
    76
	speedy.Kill(0x666);
sl@0
    77
	speedy.Close();
sl@0
    78
//
sl@0
    79
	test.End();
sl@0
    80
	return(0);
sl@0
    81
    }
sl@0
    82